Skip to main content

Allow for pulling view params from the path instead of the query string?

2 replies [Last post]
jweight
Offline
Joined: 2007-11-12
Points: 0

I know that using f:metadata and f:viewParam I can get parameters from the request's query string and bind them to some bean property. What if I would like to pull it from the URL itself?

For instance, I could do it with a URL like this:

http://my.server.com/my/page.xhtml?action=delete&id=12345

Is there any way to do it like this instead?

http://my.server.com/12345/delete/results.xhtml

Where 12345 and 'delete' would be pulled? Basically matching a URL pattern like
http://my.server.com/{id}/{action}/results.xhtml

Would I have to implement a custom ResourceResolver to do that?

Thanks,
Joel

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Lincoln Baxter, III

Hi Joel,

You should take a look at the open-source project called PrettyFaces:
http://ocpsoft.com/prettyfaces/ , which does exactly what you are looking
for.

Feel free to ask any questions on our support forums:
http://ocpsoft.com/support/

Yours,
--Lincoln

On Thu, Aug 5, 2010 at 7:28 PM, wrote:

> I know that using f:metadata and f:viewParam I can get parameters from the
> request's query string and bind them to some bean property. What if I would
> like to pull it from the URL itself?
>
> For instance, I could do it with a URL like this:
>
> http://my.server.com/my/page.xhtml?action=delete&id=12345
>
> Is there any way to do it like this instead?
>
> http://my.server.com/12345/delete/results.xhtml
>
> Where 12345 and 'delete' would be pulled? Basically matching a URL pattern
> like
> http://my.server.com/{id}/{action}/results.xhtml
>
> Would I have to implement a custom ResourceResolver to do that?
>
> Thanks,
> Joel
> [Message sent by forum member 'jweight']
>
> http://forums.java.net/jive/thread.jspa?messageID=479461
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>

--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
[att1.html]

Joel Weight

Thanks for the pointer, Lincoln. It looks like precisely what I am looking
for. Great documentation. I'll be giving it a go.

Joel

On Fri, Aug 6, 2010 at 8:54 AM, Lincoln Baxter, III
> wrote:

> Hi Joel,
>
> You should take a look at the open-source project called PrettyFaces:
> http://ocpsoft.com/prettyfaces/ , which does exactly what you are looking
> for.
>
> Feel free to ask any questions on our support forums:
> http://ocpsoft.com/support/
>
> Yours,
> --Lincoln
>
>
> On Thu, Aug 5, 2010 at 7:28 PM, wrote:
>
>> I know that using f:metadata and f:viewParam I can get parameters from the
>> request's query string and bind them to some bean property. What if I would
>> like to pull it from the URL itself?
>>
>> For instance, I could do it with a URL like this:
>>
>> http://my.server.com/my/page.xhtml?action=delete&id=12345
>>
>> Is there any way to do it like this instead?
>>
>> http://my.server.com/12345/delete/results.xhtml
>>
>> Where 12345 and 'delete' would be pulled? Basically matching a URL
>> pattern like
>> http://my.server.com/{id}/{action}/results.xhtml
>>
>> Would I have to implement a custom ResourceResolver to do that?
>>
>> Thanks,
>> Joel
>> [Message sent by forum member 'jweight']
>>
>> http://forums.java.net/jive/thread.jspa?messageID=479461
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>
[att1.html]