Hi,
I am new to
JSF, and am in need of some advice on how to achieve the below requirement. I have a datatable, with input text(which displays a value from the DB) and a checkbox in each row. On checking the checkbox, the input text is enabled for editing, and on typing the new value and hitting the submit button outside the data table, the edited value is not being retained. Kindly let me know how this can be done(i need to be able to select multiple rows and then submit all at the same time). Here is the snippet of the jsf.
<h:dataTable bgcolor="White" id="pList" binding="#{MngdBean.pDataTable}"
var="pBean" value="#{MngdBean.pBeanList}"
width="100%"
border="0"
cellpadding="3"
cellspacing="0" >
<h:column>
<f:facet name="footer">
<h:outputLabel value="Min"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:inputText value="#{pBean.Min}" immediate="true"
size="4"
id="minInputText" converter="javax.faces.Integer"
disabled="true"
style="vertical-align:top;font-size:smaller;"
/>
</h:column>
<h:column>
<f:facet name="footer">
<h:outputLabel value="Max"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:inputText size="4" id="maxInputText" immediate="true"
style="vertical-align:top;"
disabled="true" converter="javax.faces.Integer"
value="#{pBean.Max}"
/>
</h:column>
<h:column>
<f:facet name="footer">
<h:outputLabel value="check1"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:selectBooleanCheckbox id="check1"
style="align:center;"
onclick="addOnclickToDatatableRows(this)"
value="#{pBean.check1Selected}"/>
</h:column>
</h:dataTable>
</h:panelGroup>
<h:panelGroup id="panelGroup12">
<h:commandButton value="Submit"
id="save"
action="#{MngdBean.getSelectedEditedItems}" />
........
My backing bean has the following properties with getters/setters:
private List pBean;
private HtmlDataTable pDataTable;
When my action method in the backing bean gets called I see that the state of the dataTable reflects the state when it was created, not the state when the user clicked the commandButton (after they have edited some of the editable text fields).
What's the best way to get this state back into the backing bean so I can update my model?
I have already tried using immediate attribute. Can anyone give me inputs on how i can use the actionListeners (cmd button )/value change listeners(check box) to handle this? Do we need to implement processAction method for such a requirement.
Thanks in advance