0

我正在尝试在 ADF (Jdeveloper 12) 中做一个简单的“Hello World”演示。我从输入中读取了一个值,尝试更新 ADF RichOutputText(示例中的 id ot1) - 但页面不会更新。操作代码会更新,但 UI 不会更新。页面片段:

<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>

豆方法:

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;
}
4

1 回答 1

2

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

AdfFacesContext.getCurrentInstance().addPartialTarget(inputText);

顺便说一句,你最好切换到 actionListener 而不是 action。

于 2013-11-07T20:49:22.703 回答