I\'m learning how to use ajax within jsf, I made a page that does actually nothing, an input text that is filled with a number, submitted to the server, call the setter for
The <f:ajax>
processes by default only the current component (read description of execute attribute). Basically, your code is exactly the same as this:
<h:form>
<h:commandButton action="nothing">
<f:ajax execute="@this" render="num"/>
</h:commandButton>
<h:inputText value="#{helper.randomize}" id="num"/>
</h:form>
In effects, only the <h:commandButton action>
is been processed and the <h:inputText value>
(and any other input field, if any) is completely ignored.
You need to change the execute
attribute to explicitly specify components or sections you'd like to process during the ajax request. Usually, in order to process the entire form, @form
is been used:
<h:form>
<h:commandButton action="nothing">
<f:ajax execute="@form" render="num"/>
</h:commandButton>
<h:inputText value="#{helper.randomize}" id="num"/>
</h:form>