简体   繁体   English

漂亮的面孔dynamic-view-id和el参数

[英]pretty faces dynamic-view-id and el paramteres

I trying to resolve a issue regarding pretty faces pass parameters to bean: 我试图解决有关将漂亮参数传递给bean的问题:

I have configured pretty-config mapping as follows: 我已经配置了pretty-config映射,如下所示:

<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 该参数未传递到请求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) 但是当我将漂亮的面孔的配置更改为以下内容时(无动态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? Meaby有人遇到了这个问题,可以在这里提供帮助吗? 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: 但是您可以将参数直接绑定到searchView ,这样可以更好地工作:

<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. 您只需要向您的bean添加categoryId属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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