aspose file tools*
The moose likes JSP and the fly likes Problem using varStatus and c:when Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem using varStatus and c:when" Watch "Problem using varStatus and c:when" New topic
Author

Problem using varStatus and c:when

Zoe Zhao
Greenhorn

Joined: Mar 30, 2005
Posts: 4
Beginner's question: I need to show my database query result in a table, say it's 4 columns and 10 rows. Need to render it as 10 rows * 5 columns, with the 1st column a set of radio buttons so the user can pick up a row by clicking the radio button. 2nd column is the ID, so i wish to set the value of the radio button to be the value of the 2nd ID column, for each row.

Hers is my code:

<c:forEach var="row" items="${rs.rowsByIndex}">
<tr>
<c:forEach var="column" items="${row}" varStatus="loopStatus">

<c:choose>
<c:when test="loopStatus.index==1">
<td><% radio(pageContext, "bpid", "${column}", false); %>"${loopStatus.index}"</td>
<td> <c ut value="${column}"/> </td>
</c:when>
<c therwise>
<td> <c ut value="${column}"/> </td>
</c therwise>
</c:choose>


</c:forEach>
</tr>

</c:forEach>


What I see is that the radio button did't get painted, which means the c:when condition never returns true. I guess i didn't use the varStatus in the right way.

Anybody could kindly help me out here? Thank you so much!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67



Btw, if you click the 'disable smiles' checkbox when posting, your tags will look less surprised.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: Problem using varStatus and c:when