You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andre Wittenburg <an...@cth.de> on 2000/12/13 18:38:19 UTC
usage of select tag when multiple is set
Hi!
Is there a possibility to use the select tag with multiple="1" and let the
action class make the matching to a Collection in the form object?
Since yet it seems, that it is not possible to pass a collection of values
to the form object and let the action class make the reflection.
If I try <form:select property="myArrayList" multiple="1" size="8"> ... i
get the following error:
---------------------------
Mi Dez 13 18:24:24 GMT+01:00 2000:<I> <WebAppServletContext-General> action:
Populating bean properties from this request
Mi Dez 13 18:24:24 GMT+01:00 2000:<E> <WebAppServletContext-General> Root
cause of ServletException
java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.struts.util.BeanUtils.populate(BeanUtils.java,
Compiled Code)
at org.apache.struts.util.BeanUtils.populate(BeanUtils.java,
Compiled Code)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:16
92)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1320)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java, Compiled Code)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java, Compiled Code)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
--------------------------------
any suggestions???
Andre
Re: usage of select tag when multiple is set
Posted by Till Nagel <ti...@netzministerium.de>.
Hi,
> Is there a possibility to use the select tag with multiple="1" and let the
> action class make the matching to a Collection in the form object?
I have extended the Select- and the Options-Tag to support multiple select
boxes a while ago. But sadly the tags just suport String-Arrays instead of
Collections. That's because of the result type of getParameterValues(..).
One could change that (convert it into a Collection) but how to decide which
usage in BeanUtils.populate(..)?
So for now use it this way
<form:select property="myStringArray" multiple="1" size="8">
Your ObjectForm needs an attribute myStringArray which is set by the
ActionServlet.
Regards,
Till
P.S. Excuse the bad style just to change the Struts-Tags instead of really
extending them. I'd changed them quick'n'dirty.