当前位置: 首页 > 工具软件 > ADF Faces > 使用案例 >

adf开发_在EL表达式中引用ADF Faces组件

徐飞尘
2023-12-01

adf开发

EL表达式通常用于在页面上指定ADF Faces组件的属性值。 有趣的是,我们可以使用component关键字来引用要为其评估EL表达式的组件实例。 这是略与类似Java中。

例如,在以下代码段中,按钮的提示被评估为按钮的文本值,并且它的visible属性将由支持该组件作为参数的backing bean方法返回:

<af:button text="#{theBean.buttonText}" id="b1"
 shortDesc="#{component.text}" visible="#{theBean.isVisible(component)}"/>

支持bean方法可能如下所示:

public boolean isVisible(UIComponent button)
  {
    //Do something with the button
    ((RichButton) button).setIcon("images/awesomeIcon.jpg");


    //check button's attributes
    if (button. ...) 
      return true;
     else
      return false;

  }

当涉及在某个迭代器(或列表视图或表等)中呈现组件时,此技术可能非常有用,并且我们需要根据确切的组件实例动态评估组件的属性值。

而已!

翻译自: https://www.javacodegeeks.com/2018/01/referring-adf-faces-component-el-expression.html

adf开发

 类似资料: