I'm having an issue with the back button, not keeping data in a dynamic dropdown in JSF on a request scoped bean.
I have a form with 2 dropdowns where dropdown2 is dynamic based on what is selected in dropdown1. Below is my code for these dropdowns.
<h:selectOneMenu id="group" label="group" value="#{queryBacking.groupInternalId}">
<f:ajax event="valueChange" render="membership" />
<f:selectItems value="#{supportBean.groupInstitutions}" var="group" itemValue="#{group.institutionInternalId}" itemLabel="#{group.institutionName}" />
</h:selectOneMenu>
<h:selectOneMenu id="membership" label="Membership" value="#{queryBacking.institutionInternalId}">
<f:selectItem itemLabel="Select One" itemValue="0" />
<f:selectItems value="#{queryBacking.groupMembershipInstitutions}" var="institution" itemValue="#{institution.institutionInternalId}" itemLabel="#{institution.institutionShortName}" />
</h:selectOneMenu>
My code works great except that if you submit the form and then click the back button, dropdown2 does not contain any values. How can fix this issue?