Reputation: 1060
I have a search function. When user input some text to inputText
it suppose to search the text. This function I want to do with ajax function. I don't submit all the form values.
<td colspan="2" align="right">
<h:inputText id="searchTxtBox" value="#{catelogue.searchTxt}">
</h:inputText>
</td>
<td>
<h:commandLink value="Search"><f:ajax event="click" listener="#{catelogue.findText}" render="@form"/></h:commandLink>
</td>
When click Search
button, the searchTxt
variable in the managed bean
is null
.
How can I get the value to back bean ?
Upvotes: 0
Views: 1098
Reputation: 1082
1) Make sure your code is inside a h:form tag
2) This should be your f:ajax code:
<f:ajax execute="searchTxtBox" listener="#{catelogue.findText}"
render="<whatever you want to render"/>
Upvotes: 1