Hi,
I am new to Spring Web Flow and currently facing an issue which I dont know how to resolve.
Problem Domain: I have a command object that contains a list. I am displaying the data from within that list and also using a checkbox. Now I want to get the values of all the checkboxes that I select( after the page has been rendered) to be available to me in my controller.
My Command Object is:
This is a domain Object that is being autogenerated by Hibernate Tools.Code:public class Borrower { private Set<Reservation> reservations = new HashSet<Reservation>(0); ........... ...........
My JSP looks like this:
Also the Reservation Java class Looks like this :Code:<form:form commandName="borrower" method="post" > <c:set var="ddlist" value="${borrower.reservations}" /> <table width="95%" bgcolor="f8f8ff" border="1" cellspacing="0" cellpadding="5"> <c:forEach var="ddlistItem" items="${ddlist}" varStatus="rowCounter"> <tr> <td align="right" width="20%"> <form:checkbox path="reservations[${rowCounter.index}].selected"/> </td> <td> <b>reservationDateTime:</b>${ddlistItem.reservationDateTime}</br> </td> </tr> </c:forEach> </table> <br> <c:if test=""></c:if> <input name="_eventId_cancel" type="submit" value="Cancelation" /> <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" /> </form:form>
But this doesnt seem to be working. I am getting the following exceptions:Code:public class Reservation { private boolean selected; ........ ........ <other properties and their corresponding getters and setters>
My controller is extending MultiAction class of the Spring WebFlowCode:ognl.NoSuchPropertyException: org.hibernate.collection.PersistentSet.0 ognl.SetPropertyAccessor.getProperty(SetPropertyAccessor.java:67) ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657) ognl.ASTProperty.getValueBody(ASTProperty.java:92) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ognl.SimpleNode.getValue(SimpleNode.java:210) ognl.ASTChain.getValueBody(ASTChain.java:109) ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) ognl.SimpleNode.getValue(SimpleNode.java:210) ognl.Ognl.getValue(Ognl.java:333) Also : org.springframework.binding.expression.PropertyNotFoundException: Property 'reservations[0].selected' not found on context of class [org.oclc.lbs.domain.circulation.Borrower] org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:87) org.springframework.webflow.mvc.view.BindingModel.getFormattedValue(BindingModel.java:146) org.springframework.webflow.mvc.view.BindingModel.getFieldValue(BindingModel.java:128) org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:172) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:192) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:158) org.springframework.web.servlet.tags.form.AbstractCheckedElementTag.autogenerateId(AbstractCheckedElementTag.java:80) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:136) org.springframework.web.servlet.tags.form.AbstractSingleCheckedElementTag.writeTagContent(AbstractSingleCheckedElementTag.java:81) org.springframework.web.servlet.tags.form.CheckboxTag.writeTagContent(CheckboxTag.java:51) org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:90) org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77) org.apache.jsp.jsp.showReservation_jsp._jspx_meth_form_005fcheckbox_005f0(showReservation_jsp.java:261) org.apache.jsp.jsp.showReservation_jsp._jspx_meth_c_005fforEach_005f0(showReservation_jsp.java:211) org.apache.jsp.jsp.showReservation_jsp._jspx_meth_form_005fform_005f0(showReservation_jsp.java:135) org.apache.jsp.jsp.showReservation_jsp._jspService(showReservation_jsp.java:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
Can somebody tell me how binding works in web flow.
Also is it necessary to write our own binders if we need to pass a List of objects from the JSP to our controller?
Anuj.


Reply With Quote