You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Geert Van Landeghem <ge...@reynders.com> on 2003/11/14 14:48:08 UTC
RE: Checkbox values: how to substitute the value attribute by the book id?
Sumit,
I found a solution to this problem as following:
<!-- presenting the selected checkbox values -->
<logic:present name="bookListForm" property="selectedBook">
<logic:iterate id="sel" name="bookListForm" property="selectedBook">
<br>index = <bean:write name="sel"/>
</logic:iterate>
</logic:present>
<!-- the form with the checkbox for each row of the html table -->
<!-- refers to this page being executed again -->
<html:form action="/booklist">
<table width="95%" border="1">
<tr>
<th bgcolor="#330066"><font color="#FFFFFF"> </font></th>
<th bgcolor="#330066"><font color="#FFFFFF">AuthorL</font></th>
<th bgcolor="#330066"><font color="#FFFFFF">AuthorF</font></th>
<th bgcolor="#330066"><font color="#FFFFFF">Title</font></th>
</tr>
<logic:iterate id="book" name="BookListKey" scope="request">
<tr>
<td><html:checkbox property="selectedBook" value="??"><bean:write name="book" property="id"/></html:checkbox></td>
<td><bean:write name="book" property="authorLastName"/> </td>
<td><bean:write name="book" property="authorFirstName"/> </td>
<td><bean:write name="book" property="title"/> </td>
</tr>
</logic:iterate>
</table>
<html:submit>Process</html:submit>
</html:form>
-----Original Message-----
From: Sumit S. [mailto:sumits@virtusa.com]
Sent: vrijdag 14 november 2003 12:51
To: Struts Users Mailing List
Subject: RE: Checkbox values
Geert,
this would create BookListKey[i].selectedBook = 1 for "Checked" Books....
When you have to render this info try
<logic:present name="BookListKey">
<logic:iterate id="book" name="BookListKey">
<logic:equal name="book" property="selectedBook" value="1">
<br>selected index = <bean:write name="book" property="id"/>
</logic:equal>
</logic:iterate>
</logic:present>
hope this helps
Regards
Sumit
-----Original Message-----
From: Geert Van Landeghem [mailto:geert.vanlandeghem@reynders.com]
Sent: Friday, November 14, 2003 4:56 PM
To: Struts Users Mailing List
Subject: Checkbox values
Hello all,
I'm trying to show the selected rows in a html table by using check
boxes. I'm using the same jsp to show the selected row indexes of the table.
What am I'm doing wrong because I'm not able to see the selected indexes:
<logic:present name="selectedBook">
<logic:iterate id="sel" name="selectedBook">
<br>selected index = <bean:write name="sel"/>
</logic:iterate>
</logic:present>
<logic:iterate id="book" name="BookListKey" scope="request">
<tr>
<td><html:checkbox property="selectedBook"><bean:write name="book" property="id"/></html:checkbox></td>
<td><bean:write name="book" property="authorLastName"/> </td>
<td><bean:write name="book" property="authorFirstName"/> </td>
<td><bean:write name="book" property="title"/> </td>
</tr>
</logic:iterate>
tia,
met vriendelijke groeten,
salutations sincères,
kind regards,
Geert Van Landeghem
Reynders Etiketten NV
tel: +32 3 460.32.81
gsm: +32 477.75.95.33
<ma...@reynders.com>
Give me
the power to accept the things i cannot change,
the strength to change the things i can change,
and the insight to tell the difference
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org