It should work fine with @ViewScoped
.. However, you can change the value of the execute
attribute's value by: @form
in order to submit all the form :
<h:form>
<h:inputText id ="text" value="#{bean2.str1}" /><br />
<h:outputText id ="text2" value="#{bean2.str1}" /><br />
<h:commandButton value="Test">
<f:ajax execute="@form" render="text2"/>
</h:commandButton>
<h:commandButton value="Home" action="home"/>
</h:form>
Also, you had better make the result shows in a <h:outputText />
tag component rather than another <h:inputText />
.