Cri*_* A. 3 jsf el primefaces jsf-2
我正在使用JSF和PrimeFaces,但我需要获取组件id的值.因为我正在构建具有不同id的dinamycally面板,以显示我需要比较的面板,如果是当前面板,则显示它.
例如,如果我有下一个面板
<p:outputPanel id="#{bean.getID}" autoUpdate="true"
renderer=#{@this.id == bean.currentPanel}
>
</p:outputPanel>
Run Code Online (Sandbox Code Playgroud)
和豆
public class Bean(){
private int numberPanels =0;
private int currentPanel = 0;
public int getID(){
//...a process that return different ID
}
// getter's and setters
Run Code Online (Sandbox Code Playgroud)
}
显然,@this.id不起作用.那么,如何使用PrimeFaces获取componente ne JSF的ID值?
#{component}EL范围中有一个隐式对象,它评估当前的UI组件.根据此信息,您将获得以下属性:
rendered="#{component.id eq bean.currentPanel}"
Run Code Online (Sandbox Code Playgroud)