View Single Post
  #2 (permalink)  
Old 05-05-2008, 01:21 PM
rjuyal's Avatar
rjuyal rjuyal is offline
Senior Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 160
rjuyal is on a distinguished road
For Each Radio
Your Code

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>

Take this
1. u have used name="radio" , you must be having this in your dataBind. if not then have this. Better change the name to some recognizable name e.g selectedComponent

2. value="true" what does this mean. You should not use "true" here should be some value. you can use counter

3. main thing <c:if test="${status.value eq question.selectedComponent}">checked</c:if>


Hope it get clear.
__________________
Newton said Gravitaion, Rakesh says Earth Sucks
Reply With Quote