You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Célio Cidral Junior <cc...@gmail.com> on 2006/12/20 18:51:08 UTC
Values of multiple
Given the following code:
myPage.jsp:
<s:select name="selectedRoles" list="allRoles" listKey="id"
listValue="name" multiple="true"
label="%{getText('roles')}"></s:select>
MyAction.java:
public Set<String> getSelectedRoles() {
Set<String> ids = new HashSet<String>();
for (Role role : selectedRoles)
ids.add(Integer.toString(role.getId()));
return ids;
}
public List<Role> getAllRoles() {
return roleDao.list();
}
All the available roles are properly loaded to the list but the ones
returned by getSelectedRoles() are not appearing selected in the list.
I have compared my code against the Employees Manager's (from
struts2-showcase-2.0.1) and my code seems to be correct. In addition,
I debugged getSelectedRoles() to check if the selected role ids are
being correctly returned, and they actually are.
I can't catch anything wrong in my code. Could anybody help me on this?
Regards,
Célio.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Values of multiple
Posted by Dale Newfield <Da...@Newfield.org>.
I submitted a JIRA issue about this a week or so ago, and Ted marked
that it will be fixed by the 2.0.3 release.
If you find anything more about this, could you please add it to the
JIRA issue?
http://issues.apache.org/struts/browse/WW-1557
-Dale
Célio Cidral Junior wrote:
> Given the following code:
>
> myPage.jsp:
>
> <s:select name="selectedRoles" list="allRoles" listKey="id"
> listValue="name" multiple="true"
> label="%{getText('roles')}"></s:select>
>
> MyAction.java:
>
> public Set<String> getSelectedRoles() {
> Set<String> ids = new HashSet<String>();
>
> for (Role role : selectedRoles)
> ids.add(Integer.toString(role.getId()));
>
> return ids;
> }
>
> public List<Role> getAllRoles() {
> return roleDao.list();
> }
>
> All the available roles are properly loaded to the list but the ones
> returned by getSelectedRoles() are not appearing selected in the list.
> I have compared my code against the Employees Manager's (from
> struts2-showcase-2.0.1) and my code seems to be correct. In addition,
> I debugged getSelectedRoles() to check if the selected role ids are
> being correctly returned, and they actually are.
>
> I can't catch anything wrong in my code. Could anybody help me on this?
>
> Regards,
>
> Célio.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org