I'm trying to do a simple 'Hello World' demo in ADF (Jdeveloper 12). I read a value from input, try to update a ADF RichOutputText (id ot1 in the sample) - but the page won't update. The action code gets updated but not the 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 method:
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;
}
You have to trigger partial page update, so UI can catch up with the state.
AdfFacesContext.getCurrentInstance().addPartialTarget(inputText);
Btw, you better switch to actionListener instead of action.