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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to