JSF Backing Bean State Being Lost Prior to Submit
ISSUE
I have an attribute in a backing bean for a drop-down list in a JSF that loses its state before I submit the page, which causes data updates to the backing bean dependent upon its state to be ignored.
CONTEXT
The JSF in question has a selectOneMenu drop-down list that determines whether or not several inputText fields will be rendered. The selectOneMenu is bound to an enum in the backing bean, and there are conditional accessors allowing the JSF to determine which inputTexts should be included in the current view. The three valid values of the drop-down are "ALL", "RANGE" and "SINGLE". The page is request scoped, a requirement of this project.
Here is the JSF tag for the selectOneMenu drop-down list:
<h:selectOneMenu disabled="#{not backingBean.newEntry}"
id="tCriteria"
value="#{backingBean.tCriteria}"
onchange="submit()">
<f:selectItems value="#{backingBean.possibleTCriteria}" />
</h:selectOneMenu>
And here are the RANGE selection-specific inputText controls:
<h:inputText disabled="#{not backingBean.newEntry}"
rendered="#{backingBean.tRange}"
id="startTIndex"
value="#{backingBean.tIndex}" />
<h:inputText disabled="#{not backingBean.newEntry}"
rendered="#{backingBean.tRange}"
id="endTIndex"
value="#{backingBean.endTIndex}" />
Here is how I initialize the backing bean for the drop-down list attribute:
/**
* The current "t" criteria.
*/
private TCriteria tCriteria = TCriteria.ALL;
And there are basic accessor/mutator methods for it. All of this works pretty well, with one problem. If I select "RANGE" in the drop-down, the appropriate inputText fields appear in the view. When I submit the page with values in the inputText fields, the value of the drop-down in the backing bean has been reset to its default initial value ("ALL") without having been updated through its mutator. Thus, when values in the backing bean are updated from the JSF, the conditional inputText fields are ignored, as they appear to have been deemed irrelevant during the update phase by the invalid state of the backing bean for the drop-down.
To test my theory, I changed the default value of the backing bean attribute for the drop-down to be "RANGE", and made it final. The page behaves perfectly in updating the backing bean with the values entered for the conditionally-displayed inputText controls. This tells me that the invalid state of the backing bean drop-down list attribute must be the problem. Furthermore, I have tried using "disabled=", "readonly=" and "rendered=" on the conditional inputText fields, and none of that seems to make a difference. I also tried using a ValueChangeHandler, but that didn't do anything about it.
Note - the backing bean does realize that the correct state for the drop-down should be "RANGE", but only AFTER the backing bean has received its updated values from the page controls.
Has anyone seen anything like this? I haven't read anything in previous posts about an issue like this, but it has to be something someone has seen before. Maybe related to using the enum type? Thanks.

