Joey! I had this problem earlier and I fixed it now..
What you need to have in your action form is.. public Row getRow(int index) { return (Row) rows.get(index); } public void reset(ActionMapping mapping, HttpServletRequest servletRequest) { // struts check boxes do not remember the values when changed from true to false, // reset everything before setting true/false for (int i = 0; i < rows.size(); i++) { Row row = (Row)rows.get(i); row. setIsSelect (false); } } And in your jsp you can use <logic:iterate id="rows" name="yourActionForm" property="rows" type="yourClass" indexId="ctr"> <html:checkbox property='<%= "rows[" + ctr + "]. isSelect "%>' /> </logic:iterate> I hope this helps. Vidya -----Original Message----- From: Joey Watson [mailto:[EMAIL PROTECTED] Sent: Tuesday 07 February 2006 04:59 To: user@struts.apache.org Subject: How to use checkbox in struts. Hello everybody. I think this is a old question. but I can not find a good and complete example in Google. My question is : I have a Jsp page which will list some datas for user. user can choose(by click the checkbox) some of those data and click a botton for delete or some others operator. So I think my Action class , ActionForm , data class and JSP will like this. ---------------------------------------------------------------------- Row { private String isSelect; public getIsSelect() { } public setIsSelect() { } } -------------------------------------------------------------------- ActionForm { private ArrayList rows; //dynamic public get.... public set... } --------------------------------------------------------------------- Action { ... for (int i = 0; i < ActionForm.rows.size; i++){ Row row = ActionForm.rows.get(i); if ( row.isSelect =="check" ) { //Do some thing here. } } } .................................................................... JSP page. I have to use <input type = "checkbox"> or <Html:Checkout> for data list. datas quantity is not fix. can not use <html:Mutibox> and I need use a botton commit data to Action. -------------------------------------------------------------------- my problem is : 1. In Row class. If define isSelect as a String , is it ok, or boolean is better? 2. I don't know how to write <input type = "checkbox"> or <Html:Checkout> to make a checkbox, and make action can know whick is be selected. Thanks for any help. Joey This message and any attachments are confidential and intended solely for the addressee. If you have received this message in error, please notify Discovery immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration or dissemination of the contents of this email is strictly prohibited. In no event will Discovery or the sender be liable in any manner whatsoever to any person for any loss or any direct, indirect, special or consequential damages arising from use of this email or any linked website, including, without limitation, from any lost profits, business interruption, loss of programmes or other data that may be stored on any information handling system or otherwise from any assurance that this email is virus free even if Discovery is expressly advised of the possibility of such damages. Discovery is an Authorised Financial Services Provider. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]