【问题标题】:f:param or f:attribute support on primefaces autocomplete?f:param 或 f:attribute 对 primefaces 自动完成的支持?
【发布时间】:2011-07-04 03:20:22
【问题描述】:

我读到核心 JSF 组件支持 f:paramf:attribute 标记,以便将一些值传递给服务器端的封闭 UI组件。

我需要能够为 primefaces 的自动完成组件执行此操作, 以便自动完成方法能够使用 f:paramf:attribute 提供的参数。 我试着找出方法来完成这个,发现完整的方法参数是固定的,不能接受更多的参数, 因此我正在考虑使用 f:paramf:attribute

我使用的是 2.2.x 版本,根据我的实验,我似乎无法让 f:paramf:attribute 工作

<p:autocomplete ...>
   <f:param name="myParam" value="xxxx" />
</p:autocomplete>

primefaces 是否会在自动完成组件上支持此功能? 无论如何我可以找出支持参数的标签和不支持的标签吗?

谢谢!

【问题讨论】:

    标签: jsf jsf-2 primefaces


    【解决方案1】:

    终于搞定了!

    这是 jsf 部分:

    <p:autoComplete id="#{cc.attrs.id}" label="#{cc.attrs.label}"
        ....
        completeMethod="#{filterableRaceAutocompleteBean.filterRace}">
    
        <f:attribute name="filter" value="#{cc.attrs.filter}" />
    
    </p:autoComplete>
    

    这里是源代码:

    public List<Dto> filterRace(String filterString) {
        String filterValue = (String) UIComponent.getCurrentComponent(FacesContext.getCurrentInstance()).getAttributes().get("filter");
        log.debug("filter string : " + filterString + ", with query filter of : " + filterValue);
    
        ....
    
        return result;
    }
    

    【讨论】:

    • 好东西老兄:D ...帮助我摆脱了 ActionEvent。
    • 很好,但您的属性名称必须不是“param”,我怀疑 p:autocomplete 在内部使用了“param”属性。所以使用除“param”之外的任何名称。
    猜你喜欢
    • 2014-03-08
    • 2016-09-13
    • 2014-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-23
    • 1970-01-01
    相关资源
    最近更新 更多