|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Spring bind and jsp
Hey Guys
How's things This is my first project in the spring framework. I've checked and read many things but still can't seem to find a solution(which i'm sure exists) to the below problem. So i'm creating an online exam. I have a Class Question that has question Components and the jsp - exam.jsp Class:Question with appropriate getter and setter methods Code:
private List<Component> components; Class:Component Code:
private boolean candidateBelieving; exam.jsp Code:
<c:forEach items="${question.components}" var="component" varStatus="loopstatus">
<br>
<spring:bind path="components[${loopstatus.index}].candidateBelieving">
<input type="radio" name="radio" value="true" <c:if test="${status.value == true}">checked</c:if>/>
</spring:bind>
<c:out value="${component}"/>
</c:forEach>
My problem lies in the jsp code, in that It doesn't bind and set candidateBelieving to true but it used to and here's how. Previously after reading http://mattfleming.com/node/134 I set name="<cut value='${status.expression}'/>" or something similar(similar because in trying to replicate it I was unable to do so.) The radiobuttons where grouped and data was binding to the command Object(Question) which was good. Until i added in <c:if test="${status.value == true}">checked</c:if> which was setup in case the user clicks the back button provided. At that point each radio button was being treated as a seperate one. My question is how do i set the property in the spring bind tag if the radio button is ticked, have the radiobuttons as one group and have a radiobutton ticked if it was previously saved? Is it possible to do this without the spring bind tag? http://opensource.atlassian.com/confluence/spring/display/DISC/Working+with+Checkboxes Code:
<c:forEach items="${command.childArray}" var="child" varStatus="loopStatus">
<spring:bind path="command.childArray[${loopStatus.index}].selected">
<input type="hidden" name="_<c:out value="${status.expression}"/>">
<input type="checkbox" name="<c:out value="${status.expression}"/>" value="true"
<c:if test="${status.value}">checked</c:if>/>
</spring:bind>
</c:forEach>
This seems very similar but is still causing problems. Please help |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Spring bind and jsp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|