关于Primefaces自动完成功能的jsf:f:param或f:attribute支持?

f:param or f:attribute support on primefaces autocomplete?

我已经读到核心JSF组件支持f:param和f:attribute标记,以便将一些值传递给用于封装UI组件的服务器端。

我需要能够针对primefaces的自动填充组件执行此操作,
因此自动完成方法将能够使用f:param或f:attribute提供的参数。
我尝试找出实现此目的的方法,并发现完整的方法参数是固定的,不能接受更多参数,
因此,我想使用f:param或f:attribute。

我使用的是2.2.x版本,根据我的实验,我似乎无法正常运行f:param或f:attribute

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

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

谢谢 !


终于我让它工作了!

这是jsf部分:

1
2
3
4
5
6
7
<p:autoComplete id="#{cc.attrs.id}" label="#{cc.attrs.label}"
    ....
    completeMethod="#{filterableRaceAutocompleteBean.filterRace}">

    <f:attribute name="filter" value="#{cc.attrs.filter}" />

</p:autoComplete>

这是来源:

1
2
3
4
5
6
7
8
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;
}