Hi Yu, I'm pretty sure you are going to need the indexed attribute to get this to work. You might also want to try the mutibox instead of the checkbox. I have never gotten the checkbox to work in a table. I have an example of how it should work, at least as far as I can tell. When I tried debugging this it seemed that the reset method always got called at the wrong time. If you are interested in trying to get the example to work, it's in the Struts white paper at:
http://stealthis.athensgroup.com/presentations/ under Model Layer Framework. I don't have an example of using the multibox yet, since I have never tried it. -- Larry Maturo -----Original Message----- From: Yu, Yanhui [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 1:13 PM To: '[EMAIL PROTECTED]' Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found Thanks for quite a few very kind people who spent a lot of time trying to help, but I've not found the solution yet. Here is our problem again, please help us if you find a way to solve this problem: 1. There is a class called ConflictBean which has a few String attributes and a boolean attribute called isChecked to record if the jsp user checked this bean. 2. The Action constructs a few of these ConflictBean objects, stores them in an ArrayList, then sets this ArrayList in the ActionForm bean. 3. The JSP page iterates through the ArrayList to build a table so that each row of this table represents an element on the ArrayList (a ConflictBean object). All the attributes of the ArrayList element, the ConflictBean object are displayed in different column (cells) of this row. A checkbox is provided somewhere in each row (say in the most left column) so that the user can view all the rows, then he can select all/some/none of the rows (the ConflictBean objects). After the form was submitted, the Action needs to get the list back out and see which ConflictBean were checked. Please tell us if we have to use an indexed property such as the checkbox in the newer version to accomplish this or there is a way to do it with version 1.0.2? Answering this question will point us to the right direction. THANKS! Yanhui -----Original Message----- From: Yu, Yanhui Sent: Wednesday, March 27, 2002 12:03 PM To: '[EMAIL PROTECTED]' Subject: RE: Struts 1.0.2 checkbox - Error Message: No collection found Sorry I forgot that the reset method in the ActionForm looks like this: ============================================================== public void reset(ActionMapping mapping, HttpServletRequest request) { cat.debug("ConflictResolutionForm reset"); /* this.checked = false; this.linenum = null; this.field = null; this.level = null; this.currentValue = null; this.overrideValue = null; */ if(conflicts != null) { for(int i=0; i< conflicts.size(); i++) { ((ConflictBean) conflicts.get(i)).setChecked(false); } } } ============================================================== Looking forward to hearing any hints, thank you very much, Yanhui -----Original Message----- From: Yu, Yanhui Sent: Wednesday, March 27, 2002 12:00 PM To: [EMAIL PROTECTED] Subject: Struts 1.0.2 checkbox - Error Message: No collection found Hi All, We are using struts verions 1.0.2 here. I have a problem using checkbox in a jsp, getting No collection found error. Here is my sample code and I really appreciate if anyone can give me a hand on this. in jsp ===================================== <logic:iterate id="conflicts" name="ConflictResolutionForm" property="conflicts" type="com.pioneer.sales.terrmaint.demo.ConflictBean"> <tr> <td><html:checkbox name="conflicts" property="checked" /></td> <td><bean:write name="conflicts" property="field" /> </td> <td><bean:write name="conflicts" property="level" /> </td> <td><bean:write name="conflicts" property="currentValue" /></td> <td><bean:write name="conflicts" property="overrideValue" /> </td> </tr> </logic:iterate> ======================================= in ConflictBean class ======================================== private String linenum = null; private String field = null; private String level = null; private String currentValue = null; private String overrideValue = null; private boolean checked = false; // all public getters and setters for all the String attributes public boolean getChecked() { return checked; } public void setChecked(boolean _checked){ checked = _checked; } ================================================== in Action class ================================================== ConflictResolutionForm conFlictForm = new ConflictResolutionForm(); ArrayList conflicts = new ArrayList(); // Fill in the list here ConflictBean cb = new ConflictBean(); cb.setLinenum("1"); cb.setField("Field 1"); cb.setLevel("Area"); cb.setCurrentValue("012345678"); cb.setOverrideValue("012345678"); conflicts.add(cb); conFlictForm.setConflicts(conflicts); return (mapping.findForward("conflictresolution")); //set up in struts-config.xml ==================================================== in ActionForm ===================================================== private ArrayList conflicts = null; public ArrayList getConflicts() { return conflicts; } public void setConflicts(ArrayList _conflicts) { conflicts = _conflicts; } public ConflictBean getConflicts(int index) { return (ConflictBean) conflicts.get(index); } public void setConflicts(int index, ConflictBean conflict) { conflicts.set(index,conflict); } ====================================================== Any help would be greatly appreciated. What I did wrong here? Maybe multibox is what I need? Yanhui -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>