Hi,
When <t:subform ...> is used within <h:dataTable>, subforms that are not
submitted loose value changes (they load values from the model even if
preserveSubmittedValues="true").
In the following UI Mark up, I make changes to the first name and first
score and click submit. Changes made to score are retained (as it is part of
the submitted sub-form) but changes made to name are not retained.
<h:form> <h:dataTable value="#{contentController.students}" var="student">
<h:column> <t:subform id="nameSubForm"> <h:inputText value="#{student.name}"/>
</t:subform> <t:subform id="scoreSubForm"> <h:inputText
value="#{student.score}"/> <t:commandLink value="submit"
action="#{contentController.add}" actionFor="scoreSubForm"/> </t:subform>
</h:column> </h:dataTable> </h:form>
The controller is:
class ContentController
{
private List<Student> students; public List<Student> getStudents() { if
(null == students) { students = new ArrayList<Student>(10); for ( int i = 0;
i < 10 ; i++ ) { String studentName = "Name" + i; Student student = new
Student(); student.setName(studentName); student.setScore(i);
students.add(student); } } return students; } public String add() { return
null; }
}
Student.java:
public class Student { private String name; private int score; public String
getName() { return name; } public void setName( final String name ) {
this.name = name; } public int getScore() { return score; } public void
setScore( final int score ) { this.score = score; } }
Would appreciate any pointers on what could be going wrong.
TIA,
Babu