<h:form>
Do you have a driving license?
<h:selectOneMenu value="#{requestScope.license}">
<f:selectItem itemLabel="Select..." itemValue=""/>
<f:selectItem itemLabel="Yes" itemValue="Y"/>
<f:selectItem itemLabel="No" itemValue="N"/>
<f:ajax render="@form"/>
</h:selectOneMenu>
<br/>
Enter driving license number:
<h:inputText value="#{requestScope.number}"
rendered="#{'Y' eq requestScope.license ? true : false}"/>
<br/>
<h:commandButton value="Submit"/>
<br/>
Your driving license number is: #{requestScope.number}
</h:form>
Problem in implementing a VERY COMMON scenario with JSF 2.0
The above JSF 2.0 markup depicts a very common scenario.
If the user selects “Yes” for the question “Do you have a driving license?”, then the “Enter your driving license number:” field is rendered by Ajax.
If the user enters the driving license number and presses the button, the input data should be displayed at the bottom (according to my understanding), but it is not happening.
Please anyone explain this.