Michał Ziembiński
Michał Ziembiński

Reputation: 1164

pretty faces dynamic-view-id and el paramteres

I trying to resolve a issue regarding pretty faces pass parameters to bean:

I have configured pretty-config mapping as follows:

<url-mapping id="frontend_search"> 
    <pattern value="/szukaj/#{ categoryId }" />   <!-- pass parameter from url -->
    <view-id value="#{searchView.getViewPath}" />  <!-- dynamic view id -->
</url-mapping>

Problem is that. The parameter is not being passed into request parametersMap

    String catId = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("categoryId"); 

is null

but when i change configuration of pretty faces to the following (no dynamic view-id)

<url-mapping id="frontend_search"> 
    <pattern value="/szukaj/#{ categoryId }" />   <!-- pass parameter from url -->
    <view-id value="/faces/template_1/frontend/pages/products/search.xhtml" />  <!-- no dynamic view id -->
</url-mapping>

it works fine!. I cant understand why that happen. Meaby somebody have been that problem and can help here? I Will grateful for help

Upvotes: 0

Views: 298

Answers (1)

chkal
chkal

Reputation: 5668

Not sure why this way isn't working. But you could bind the parameter directly to the searchView, which could work much better:

<url-mapping id="frontend_search"> 
    <pattern value="/szukaj/#{searchView.categoryId}" />
    <view-id value="#{searchView.getViewPath}" />
</url-mapping>

You will just need to add the categoryId property to your bean.

Upvotes: 1

Related Questions