<h:dataTable value="#{studentBean2.studentList}" var="student">
<h:column>
<f:facet name="header">
<h:outputText value="STUDENT-ID" />
</f:facet>
<h:outputText value="#{student.studentId}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="STUDENT-NAME" />
</f:facet>
<h:inputText value="#{student.studentName}" />
</h:column>
.........
.........
</h:dataTable>
<h:commandButton type="submit" action="#{studentBean2.action}" value="ENTER" />
As from the above code, datatable values can be edited in <h:inputText>
field and submitted. Those edited values are seen in action()
method of bean StudentBean2
.
As I followed the log, it showed that when I submit the page in the phase "Apply Request Values" the getStudentList()
method is called. In this method I do the JDBC call to fetch students from the Database and set the newly fetched studentlist
.
But in the "Invoke Application" phase, in method action()
I get the edited data in the list which I have submitted. How exactly does this happen?