Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

S2:The value of checkbox getted in server-side is "false" when no any checkbox been selected.

Denis Ling

2006-12-18


jsp section:

<s:iterator value="%{#request.rolePs.items}" id="role" status="status">

 <tr >
          <td height="25" width="5%">
            <s:checkbox name="roleId" fieldValue="%{id}"
theme="simple"/>
          </td>
 </tr>
........
</s:iterator>

action section:
....
    private String[] roleId;
public String[] getRoleId() {
return roleId;
}

public void setRoleId(String[] roleId) {
this.roleId = roleId;
}
.....

the retrieved value of "roleId" is {"false"} when user doesn't select any
checkbox elements. In my opinion, this case should returns null directly.

I very appreciate anybody who can give me any suggestion!
--
Thanks & Regards
Denis Ling
©2008 junlu.com - Jax Systems, LLC, U.S.A.