Re: h:link rendered as http://bla?com.ocpsoft.mappingId=home

Splash Forums PrettyFaces Users h:link rendered as http://bla?com.ocpsoft.mappingId=home Re: h:link rendered as http://bla?com.ocpsoft.mappingId=home

#21636

It’s different for h:commandButton because you typically don’t directly add the navigation outcome to the action attribute but instead call a method in the backend which then returns the navigation outcome. The backend method then simply sets the desired path parameter values directly in the referenced been and returns the PrettyFaces navigation string. This is the only possible way for an action method to “set path parameters”. Actually it is some kind of workaround, because you cannot use something like f:param to build the URL in the action method.

See the relevant chapter in the documentation for details:

http://ocpsoft.com/docs/prettyfaces/3.3.0/en-US/html/navigation.html#navigation.actions

And yes, you will always have to specify all path parameters of the mapping when using the pretty:link component. Making them optional won’t work because which f:param belongs to which path parameter is determined by looking at the position of the f:param.

But I think using a simple composite component will help you to create URLs more easily.

Christian