Java 无法在Oracle adf的构造函数中获取声明性组件托管bean中传递的属性

Java 无法在Oracle adf的构造函数中获取声明性组件托管bean中传递的属性,java,oracle-adf,declarative,Java,Oracle Adf,Declarative,我有一个声明性组件,其中的组件ui是在运行时根据传递给标记的参数生成的 现在我想在组件类/托管bean的构造函数中获取属性值 第一次加载调用此声明性组件的jspx时,DC的组件类打印EL:{attrs}为空。这是一个问题,因为没有它,我无法初始化表单UI 有人能告诉我如何访问传递的属性吗?我假设您的声明性组件页面上有以下标记 <af:componentDef var="attrs" ...possible other stuff... > 如果是这样,您还应该定义一个标记,其中包含

我有一个声明性组件,其中的组件ui是在运行时根据传递给标记的参数生成的

现在我想在组件类/托管bean的构造函数中获取属性值

第一次加载调用此声明性组件的jspx时,DC的组件类打印EL:{attrs}为空。这是一个问题,因为没有它,我无法初始化表单UI


有人能告诉我如何访问传递的属性吗?我假设您的声明性组件页面上有以下标记

<af:componentDef var="attrs" ...possible other stuff... >
如果是这样,您还应该定义一个标记,其中包含组件的可能参数。例如:

<attribute>
  <attribute-name>customLabel</attribute-name>
  <attribute-class>java.lang.String</attribute-class>
</attribute>
下面是一个简单完整的示例:

<af:componentDef var="attrs" componentVar="component">
      <af:panelGroupLayout id="time" layout="horizontal">
         <af:outputText id="ot1" label="#{attrs.customLabel}"/>
      </af:panelGroupLayout>
      <af:xmlContent>
         <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
            <display-name>weirdLabel</display-name>
            <attribute>
               <attribute-name>customLabel</attribute-name>
               <attribute-class>java.lang.String</attribute-class>
            </attribute>
            <component-extension>
               <component-tag-namespace>component</component-tag-namespace>
               <component-taglib-uri>http://www.example.com/components</component-taglib-uri>
            </component-extension>
         </component>
      </af:xmlContent>
   </af:componentDef>

因此,在组件bean中获取{attrs.customLabel}的EL应该会给您提供正确的值。

我得到了这么多,但不是在构造函数执行期间。当时我得到的值为null:anyideas。