Hi,

    In my form I have employee number, name, and roles, here employee number
and name are text fields and roles is a checkboxlist, to generate the list
boxes i had a map called rolesMap in my action class, as well i have a set
called userRoles that specifies the items to be selected.
*jsp*

<s:checkboxlist key="roles" list="rolesMap" value="userRoles"
name="userRoles" />

*action class*

    public Set<Long> getUserRoles() {
        return userRoles;
    }

@RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName="userRoles",message="",key="requiredstring")
    public void setUserRoles(Set<Long> userRoles) {
        this.userRoles = userRoles;
    }
    public Map<Long, String> getRolesMap() {
        generateRoles();
        return rolesMap;
    }
    public void setRolesMap(Map<Long, String> rolesMap) {
        this.rolesMap = rolesMap;
    }
    private generateRoles(){
     ----
     ----
    }

it is coming fine when i generate the form, but when i submit the form it is
throwing exception....
*stack trace ...*

Jul 17, 2008 2:25:33 PM org.apache.catalina.core.ApplicationDispatcher
invoke
SEVERE: Servlet.service() for servlet jsp threw exception
tag 'checkboxlist', field 'list', name 'userRoles': The requested list key
'rolesMap' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unknown location]
    at
org.apache.struts2.components.Component.fieldError(Component.java:231)
    at org.apache.struts2.components.Component.findValue(Component.java:293)
    at
org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:79)

i couldnt find the fix for this... can any one please guide me to solve this
problem.

Reply via email to