Re: Query Parameters displayed in URL

Splash Forums PrettyFaces Users Query Parameters displayed in URL Re: Query Parameters displayed in URL

#20847

This sounds like a perfect example for path parameters and page actions:

<url-mapping id="store">
<pattern value="/store/#{storeBean.categoryName}" />
<view-id>/faces/store.xhtml</view-id>
<action>#{storeBean.onLoad}</action>
</url-mapping>

An a bean like this one:

@ManagedBean
@RequestScoped
public class Page2Backing {

private String categoryName;

private Category category;

/* .... */

public void onLoad() {
this.category = categoryDao.findByName(categoryName);
}

}

Please note that in this example you won’t have the ID to load the correct category but only the name. But this is required if you want SEO friendly URLs without IDs.

Here a few references to the documentation:

http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/Configuration.html#config.pathparams

http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/Configuration.html#config.actions

Christian