Re: conditional url-mapping

Splash Forums PrettyFaces Users conditional url-mapping Re: conditional url-mapping

#21413

Is it a requirement for you to have all the parameters as path parameter? Path parameters don’t fit very well if the parameter has a more optional nature. You could use query parameters for this:

<url-mapping id=”products”>

<pattern value=”/products/”/>

<query-param name=”order”>#{myListBean.order}</query-param>

<query-param name=”producer”>#{myListBean.producer}</query-param>

<query-param name=”group”>#{myListBean.group}</query-param>

<view-id value=”/products.html”/>

</url-mapping>

Then you would have URLs like this:

/products/
/products/?order=0
/products/?group=someGroup
/products/?order=1&group=someGroup
/products/?order=0&producer=someProducer

You can use any combination of these parameters you want!