I have a @ViewScoped
wordController CDI bean. It has a method addWord()
that adds variable currentWord
to a List
. It works fine with no AJAX, but as soon as I include the f:ajax
, the variable currentWord
is always null in the addWord()
method. There is something I am missing on the way ajax works with JSF. What is going wrong here?
<h:form id="saveForm" styleClass="form">
<h:inputText value="#{wordController.currentWord}" id="words" />
<h:commandButton action="#{wordController.addWord()}" type="submit" value="+">
<f:ajax render="wordlist" />
</h:commandButton>
<h:panelGroup id="wordlist">
....