Reply To: URL Params from action method

Splash Forums PrettyFaces Users URL Params from action method Reply To: URL Params from action method

#27452

Hi,

To do this, you’ll need to create a “mapped query-parameter” in your pretty-config.xml file (or your class configuration if you are using annotations.)

http://www.ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/Configuration.html#config.queryparams

<url-mapping id="store"> 
   <pattern value="/store/" /> 
   <view-id value="/faces/shop/store.jsf" />
   <query-param name="section"> #{bean.section} </query-param>
</url-mapping>

Then you just need to set the value of the bean before navigating to the page:

public String onCommandButton() {
   bean.setSection("shoes");
   return "pretty:store";
}

PrettyFaces will extract the parameter value and use it when creating the URL.

I hope this helps.