Hi Sharath, do You have getSelected_rows() method in action? s:checkbox need to know what values are present somehow, and it asks the action for the field value that it generates.
Best greetings, Paweł Wielgus. 2010/7/13 sharath karnati <karna...@yahoo.com>: > I don't think I can use <s:checkboxlist> in my requirement. The checkboxs are > created inside <s:iterator>. Is this not possible using <s:checkbox>?? > > --- On Tue, 7/13/10, Chris Pratt <thechrispr...@gmail.com> wrote: > > > From: Chris Pratt <thechrispr...@gmail.com> > Subject: Re: Pre-selected s:checkbox problem. > To: "Struts Users Mailing List" <user@struts.apache.org> > Date: Tuesday, July 13, 2010, 12:07 PM > > > Look at the <s:checkboxlist> instead, it automatically handles maintaining > state. > (*Chris*) > > On Tue, Jul 13, 2010 at 9:04 AM, sharath karnati <karna...@yahoo.com> wrote: > >> Hi All, >> >> Say I'm declaring <s:checkbox> in <s:iterator> >> >> <s:iterator value="employeeList"> >> <tr align="left"> >> <td align="center"> >> <s:checkbox name="selected_rows" fieldValue="%{emp_id}"/> >> </td> >> <td> >> <s:property value="emp_id"/> >> </td> >> <td> >> <s:property value="emp_name"/> >> </td> >> <td> >> <s:property value="dept_name"/> >> </td> >> </tr> >> </s:iterator> >> >> <tr> >> <td align="left"> >> <b>Select Division: </b> >> <s:select headerKey="" headerValue="-- Select --" >> key="staff_division" list="division_list" >> onchange="javascript:getDivisionUserValues('userList');" /> >> >> <b> Select User: </b> >> >> <s:select headerKey="" headerValue="-- Select --" >> key="staff_name" list="staff_list" /> >> >> </td> >> </tr> >> >> in action class "selected_rows" is selected as String[] >> >> When user selects 'Division" then I'm calling my action and populating >> "staff_list" and re-displaying same page. >> >> The problem is that I selected checkbox for emp_id 100,102,105, when it >> is re-displaying page because of division selection, it is not showing >> selected checkbox as pre-selected. >> >> In action the array is populated with these values but when it is >> re-displaying page it is showing unchecked. >> >> Can anyone please let me know, how to display page with selected >> checkboxs using "selected_rows" array. >> >> Thanks in advance. >> >> Regards, >> Sharath. >> >> >> > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org