Re: URL build question

Splash Forums PrettyFaces Users URL build question Re: URL build question


Yes, that’s right. If you are using h:link or pretty:link, you have to specify the values of all path and query parameters using f:param child elements.

I understand your confusion, but your example is some kind of special case. In a typical use case the path parameter contains something that identifies the resource you are trying to view. Think of a mapping like this:

<url-mapping id="userDetails">
<pattern value="/user/#{userDetailsPage.username}" />
<view-id value="/user-details.jsf" />

A typical URL for this mapping would be /user/chkal. If you are building a link to a user details page, you will typically not wan’t to use some “current value” to build the URL, but use some value that is available in your current context. Think of a table that lists users. It would look like this:

<h:dataTable var="user" value="#{userList.users}" ....>


<pretty:link mappingId="userDetails">
<f:param value="#{user.username}" />
Show details


This way you can render a large number of links, each one pointing to a different user. We think that this is the most common use case. In your example adding the f:param each time to your link is some kind of redundant, but unfortunately you have to do this to make the link rendering work.

I hope this explains it. :)