Re: How to get Parameter with prettyfaces?

Splash Forums PrettyFaces Users How to get Parameter with prettyfaces? Re: How to get Parameter with prettyfaces?


What Lincoln and I are talking about is something like this. Your second page will be mapped like Lincoln suggested:

<url-mapping id="itemslist">
<pattern value="/index/category/#{catItemsListController.nameOfCategory}" />

This means the name of the category is embedded into the URL and will be injected into the field nameOfCategory of catItemsListController. After injection loadData() will be called. This method will typically load all required data from the database that is required by itemlist.xhtml to render correctly. This page is now completely independent from any other page of your application. If you enter an address like /index/category/test in the browser bar, the page will work as expected.

In your first page you will now only have to create a “pretty link” to the second page. You have different options for this. One is to use pretty:link. Here is an example:

<h:dataTable var="category" ....>


<pretty:link mappingId="itemslist">
<f:param value="#{}"/>
Show Items


This will render a standard HTML link containing the category name in the URL. If a user clicks on the link, the browser will send a GET request to this URL and the user will see your second page. This way you won’t need any JSF postback and so you don’t need to “transfer” a parameter from one page to another.

I hope this helps.