DataModel and data binding
qpool.char Apr 17, 2008 5:18 PMHello,
i try to find out how to do a databinding for a dataModel.
@DataModel(scope=ScopeType.PAGE) public Collection<WorkflowPropertiesVO> tableContentProperties;
The stateless sessionBean provides a @factory method, which is invoked successfully, besides all imaginable getter and setter methods.
In the web-page, several properties are shown correctly. I like to be able to change them in a <h:form>
and then submit the changes. But after pressing the submit-button, the collection stays as it is before at backend-side.
Simplified JSF code:
<h:form>
<h:dataTable id="flujoList" var="workflow"
value="#{tableContentProperties}"
rendered="#{not empty tableContentProperties}"
cellspacing="5">
<h:column>
<f:facet name="header"> Nombre del flujo </f:facet>
#{workflow.name}
</h:column>
<h:column>
<f:facet name="header"> Form initial </f:facet>
<h:selectOneMenu id="formInitial" value="Choose one">
<f:selectItems value="#{ProcessPropertiesManagement.allForms}" />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header"> Tasks </f:facet>
<h:dataTable cellpadding="5" id="taskList" value="#{workflow.tasks}" var="singleTask" border="1" rendered="true">
<h:column>
<f:facet name="header"> Nombre </f:facet>
#{singleTask.taskName}
</h:column>
<h:column>
<f:facet name="header"> Critical </f:facet>
<h:selectBooleanCheckbox id="newCritical" value="#{singleTask.critical}" />
</h:column>
[...]
</h:dataTable>
</h:column>
</h:dataTable>
<h:commandButton action="#{ProcessPropertiesManagement.update}" value="Guardar" />
<h:commandButton action="#{ProcessPropertiesManagement.end}" value="Cancelar" />
</h:form>
So, lets say you change the value of the first combobox and then press the update-button. But in the backend update-method, all values are still the same.
Maybe i do something wrong with the scopes? Or maybe i dont understand how the databinding works at all...
Any hints plz?
Thx in advance