struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharath karnati <karna...@yahoo.com>
Subject Re: Pre-selected s:checkbox problem.
Date Tue, 13 Jul 2010 16:18:09 GMT
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 <thechrispratt@gmail.com> wrote:


From: Chris Pratt <thechrispratt@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 <karnatis@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.
>
>
>



      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message