我正在使用 JSF 和 PrimeFaces,但我需要获取组件 id 的值。因为我正在构建具有不同 id 的动态面板,所以要显示我需要比较的面板是否是当前面板,然后显示它。
例如,如果我有下一个面板
<p:outputPanel id="#{bean.getID}" autoUpdate="true"
   renderer=#{@this.id == bean.currentPanel}
>
</p:outputPanel>
和豆
public class Bean(){
  private int numberPanels =0;
  private int currentPanel = 0;
  public int getID(){
     //...a process that return different ID
  }
  // getter's and setters
}
显然,@this.id行不通。那么,如何使用 PrimeFaces 获取 JSF 组件的 ID 值呢?