简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM