Although I consider myself a rather experienced JSF developer I still
occasionally hit a strange bit of functionality which hit me as
unexpected.  Can anyone tell me if the following test case is expected
behavior and if it is expected why is it?  (FYI The test below
functions the same in MyFaces and the JSF-RI so I imagine it is a spec
question)

Given the following test case:
------------test.jsp-------------
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
<f:view>
        <h:form>
                <h:dataTable value="#{test.values}" var="value">
                        <h:column>
                                <h:message for="item"/>
                                <h:inputText id="item" required="true" /><br/>
                        </h:column>
                </h:dataTable>
                <h:inputText id="item2" /><br/>
                <br/>
                <h:commandButton value="Submit Me"/>
        </h:form>
</f:view>

-------------------Test.java-------------------
import java.util.ArrayList;
import java.util.List;

public class Test {
        public List getValues() {
                List values = new ArrayList(4);
                values.add(null);
                values.add(null);
                values.add(null);
                values.add(null);
                return values;
        }
}

Basically, if you populate all of the inputText boxes and press
"Submit Me" then the top 4 forget their value but the bottom one does
not.  If you only populate a subset of the top 4 boxes (invoking an
invalid state for the table) then all the fields are remembered. 
However, once all fields are populated the components in the table
forget their state again when submitted.  All the while the bottom
inputText that resides outside the dataTable remembers its state the
whole time.

Can anyone tell me why the dataTable does not remember the state of
its children always like all other components?

Mike

Reply via email to