You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephan Niedermeier <s....@logabit.com> on 2003/06/15 16:18:18 UTC

html:select and html:options example?

Hello,

who can give me an example, how to use the html:select in conjunction with
html:options? I had already defined an ActionForm and JSP like follows. The
listing of the option-Elements works fine but not the "reshowing" of the
selected elements of the list, because after I have clicked the submit
button I've got an IllegalArgumentException (BeanUtils.populate):

java.lang.IllegalArgumentException: argument type mismatch
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1789)
	at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1684)
	at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
13)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
{...}

My FormBean looks like this:
{...}
public final class RoleEditForm extends ActionForm {
    {...}        public void setAllUsers(ArrayList allUsers)
 this.allUsers = allUsers;    }        public ArrayList getAllUsers()
 return this.allUsers;    }
    {...}}
The allUsers list contains user objects. The user objects have the accessor
methods getId(), getName().
My JSP looks like this:
<html:form action="/formRole" method="get">
<html:select property="allUsers" multiple="true">    <html:options
collection="allUsers" property="id" labelProperty="name" /></html:select>
<html:submit/>
</html:form>

After clicking the submit button I've got the Exception. That's wrong?

Thank you very much!
Regards
Stephan



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org