f:param 或 f:attribute 支持 primefaces 自动完成? [英] f:param or f:attribute support on primefaces autocomplete?
问题描述
我读过核心 JSF 组件支持 f:param 和 f:attribute 标签,以便将一些值传递给服务器端用于封闭 UI组件.
I've read that the core JSF components support the f:param and f:attribute tag, in order to pass some values to the serverside for the enclosing UI Components.
我需要能够为 primefaces 的自动完成组件执行此操作,以便自动完成方法能够使用 f:param 或 f:attribute 提供的参数.我尝试寻找方法来实现这一点,并发现完整的方法参数是固定的,不能带更多的参数,因此我在考虑使用 f:param 或 f:attribute.
There's a need for me to be able to do this for primefaces' autocomplete component, so that the autocomplete method will be able to make use of the parameter supplied by the f:param or f:attribute. I tried finding out ways to accomplish this, and found out that the complete method parameter is fixed and cannot take more arguments, hence im thinking of using f:param or f:attribute.
我使用的是 2.2.x 版本,根据我的实验,我似乎无法让 f:param 或 f:attribute 工作
Im use the 2.2.x version, and based on my experiment, i cant seem to get the f:param or the f:attribute working
<p:autocomplete ...>
<f:param name="myParam" value="xxxx" />
</p:autocomplete>
primefaces 是否会在自动完成组件上支持此功能?无论如何我可以找出哪些标签支持参数,哪些标签不支持?
Is primefaces going to support this feature on the autocomplete component ? Is there anyway i can find out which tags that support the parameters and those who dont ?
谢谢!
推荐答案
我终于搞定了!
这是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;
}
这篇关于f:param 或 f:attribute 支持 primefaces 自动完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!