Requirement: There are 2 text boxes and a command button on a page. Type in first textbox and click the button, typed text should appear on the second textbox.
What I used: RAD8.0 default implementation of JSF2.0
What I did:
1)
<h:inputText styleClass="inputText" id="text1"></h:inputText>
<h:inputText styleClass="inputText" id="text2" value="#{textBean.textValue}"></h:inputText>
<h:commandButton type="submit" value="Submit"
styleClass="commandButton" id="button1" action="#{managedBean.showText}"></h:commandButton>
2) textBean is a request-scoped backing bean with textValue attribute and its setters and getters
3) managedBean is the RAD-generated, request-scoped bean with all the component getters, in which I have the showText action as foll
4) finally the navigation rule
<navigation-rule>
<navigation-case>
<from-action>#{managedBean.showText}</from-action>
<from-outcome>copyText</from-outcome>
<to-view-id>/JsfTestPage.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Question: Is there a better (simpler) way to code for the above requirement? I am still trying to get my head around the lifecycle..so forgive this question..isn't it possible to do a simple text2.value=text1.value somewhere?