RichOutputText不会以编程方式更新

时间:2013-11-07 20:43:58

标签: refresh oracle-adf

我试图做一个简单的“Hello World' ADF演示(Jdeveloper 12)。我从输入中读取一个值,尝试更新ADF RichOutputText(示例中的id ot1) - 但页面不会更新。动作代码更新但不是UI。 page snippet:

<f:view>
  <af:document title="hello.jspx" id="d1" binding="#{backingBeanScope.backing_hello.d1}">
      <af:form id="f1" binding="#{backingBeanScope.backing_hello.f1}">
          <af:decorativeBox id="db1" binding="#{backingBeanScope.backing_hello.db1}">
              <f:facet name="center"/>
              <f:facet name="top">
                  <af:outputText value="" id="ot1" binding="#{backingBeanScope.backing_hello.ot1}"/>
              </f:facet>
          </af:decorativeBox>
          <af:panelGroupLayout id="pgl1" binding="#{backingBeanScope.backing_hello.pgl1}">
              <af:panelGroupLayout id="pgl2" binding="#{backingBeanScope.backing_hello.pgl2}" halign="center"/>
          </af:panelGroupLayout>
          <af:inputText label="Your Name?" id="it1" binding="#{backingBeanScope.backing_hello.it1}"/>
          <af:button text="Go" id="b1" binding="#{backingBeanScope.backing_hello.b1}"
                     action="#{backingBeanScope.backing_hello.b1_action}"/>
      </af:form>
  </af:document>

bean方法:

public String b1_action() {
    RichInputText inputText = getIt1(); 
    String name = "Hello "+(String)inputText.getValue()+ "!";
    System.out.println("This Is Entered "+name);
    ot1.setValue(name);
    return null;
}

1 个答案:

答案 0 :(得分:2)

您必须触发部分页面更新,因此UI可以赶上状态。

AdfFacesContext.getCurrentInstance().addPartialTarget(inputText);

顺便说一下,你最好切换到actionListener而不是动作。

相关问题