You should be able to fix the problem by just using plain HTML:
<input type="checkbox" name="selectedCandidates" value="${candidate.id}" />
Although I'm not sure why it wouldn't work the way you have it. Also if
you do go the plain HTML route it won't be repopulated if there are
validation errors.
Aaron
ping lu wrote:
Hi, all,
while playing with Stripes indexed check box, I hit a wall.
The scenario is straight forward:
1. step one, retrieve a list of object called "candidates" from the
database, and put this in flash scope (Attribute name =
"candidateListInFlash").
2. step two, display the contents of the candidate list in a table,
such as id and lastName, plus an indexed checkbox for each row.
3. step three, try to capture the checkboxes (the id of the
candidates) the user clicked. And those values are defined as a list
of Long in the action class with property name of "selectedCandidates".
private List<Long> selectedCandidates;
public List<Long> getSelectedCandidates() {
return selectedCandidates;
}
public void setSelectedCandidates(List<Long> selectedCandidates) {
this.selectedCandidates = selectedCandidates;
}
The problem is in step two, in the displaying jsp, with code of:
<s:form beanclass="com.bla.mvc.checkBoxActionBean">
<table>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>checkbox</th>
</tr>
<c:forEach var="candidate" items="${candidateListInFlash}"
varStatus="loop">
<tr>
<td>
<c:out value="${candidate.id}"/>
</td>
<td><c:out value='${candidate.firstName}'/> </td>
<td><c:out value='${candidate.lastName}'/> </td>
<td>
<s:checkbox name="selectedCandidates"
value="${candidate.id}" />
</td>
</tr>
</c:forEach>
</table>
<s:submit name="checkBox2"/>
</s:form>
Somhow, in the <s:checkbox name="selectedCandidates"
value="${candidate.id}" /> statement, the value="${candidate.id}" is
never rendered in the jsp. For example, in the html source of the jsp,
the value for a row of data looks like that:
<tr>
<td>110796</td>
<td>Dave</td>
<td>BROWN </td>
<td>
<input value="${candidate.id}" type="checkbox" name="selectedCandidates" />
</td>
</tr>
See, the ${candidate.id} value is never rendered in the checkbox
field. I have tried various way, nothing is working. By the way, if I
put a hard code value such as <s:checkbox name="selectedCandidates"
value="4" />, the whole things works in hard way.
So value="${candidate.id}" renders fine in regular jstl tag, but
doesn't work inside the stripes checkbox tag in indexed property
scenario. Is there anything I am missing or should do differently?
Your helps are greatly appreciated.
Lu
------------------------------------------------------------------------
Windows Live Hotmail now works up to 70% faster. Sign up today.
<http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008>
------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users