struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Bate <>
Subject [REPOST] Problem updating bean from multi-select box
Date Mon, 01 Mar 2004 15:52:02 GMT

I posted this a week ago and didn't get a resolution - now I'm back on the
case I would appreciate a few ideas on what else I could try:-

Here's a bit more info (bean names etc sanitised to protect the innocent...)

The main FormBean:-
	public class MyFormBean extends MyAncestorFormBean {
		private MyBean myBean = null;
	<snip getters/setters and other stuff>

The embedded bean:-
	public class MyBean extends SomeOtherBean {
		private Collection myCollection             = null;
		private Collection myCollectionListData = null;
	<snip getters/setters and other stuff>

Relevant content of the JSP with the multi-select box:-
	<html:select property="myBean.myCollection" multiple="true"
		<html:options name="myFormBean"

Error log:-
DEBUG 2004-03-01 15:15:39,437 [worker2] intuser@SessionID0 -
org.apache.commons.beanutils.BeanUtils     Target name = myCollection
DEBUG 2004-03-01 15:15:39,447 [worker2] intuser@SessionID0 -
org.apache.commons.beanutils.ConvertUtils Convert string 'Lalalalala' to
class 'java.util.Collection'
DEBUG 2004-03-01 15:15:39,447 [worker2] intuser@SessionID0 -
org.apache.commons.beanutils.ConvertUtils   Using converter
javax.servlet.ServletException: BeanUtils.populate
        at javax.servlet.http.HttpServlet.service(
        at javax.servlet.http.HttpServlet.service(

Basically, I have a field on a page which is a multi-select box showing 7
items.  The currently selected values are in "myCollection", the available
values are in "myCollectionListData".  The HTML <SELECT> displays fine with
all the options but when I submit the page, and Struts (more specifically
Jakarta Commons), tries to put the data back into the form bean, it blows up
with the error above.

Am I missing something or will the above just never work?  If I'm barking up
the wrong tree can anyone suggest an alternative approach?



>  -----Original Message-----
> From: 	Andrew Bate  
> Sent:	23 February 2004 10:47
> To:	''
> Subject:	Problem updating bean from multi-select box
> Hi,
> I am having a problem with the internals of BeanUtils/RequestUtils when my
> posting changes of a form to an action where the page contains a
> multi-select box.  Can anyone spot what I am doing wrong from the code
> snippets below..?
> [MyBean] (inside the Form Bean)
> 	public void setMyFieldList(Collection myFieldList)   (list
> containing the options to choose from)
> 	public Collection getMyFieldList()
> 	public void setMyField (Collection myField)	  (the field in
> question, multi-option)
> 	public Collection getMyField()
> [JSP]
> 	<html:select property="myBean.myField" multiple="true" size="7">
> 		<html:options name="myFormBean"
> property="myBean.myFieldList"/>
> 	</html:select>
> The page renders fine and automatically selects the right items in the
> list but when the page is updated things blow up trying to update the data
> back into the bean inside RequestUtils.
> Do I need to do anything else to tell the posted data to go back into the
> main field (which is a collection)?
> Thanks,
> Andrew
> -- 
> Andrew Bate
> Serco Justice
> Direct Line: (01452) 880433
> Email:
This e-mail and any attachments may contain confidential and/or privileged
material; it is for the intended addressee(s) only.  If you are not a named
addressee, you must not use, retain or disclose such information.

Serco cannot guarantee that the e-mail or any attachments are free from

The views expressed in this e-mail are those of the originator and do not
necessarily represent the views of Serco.

Nothing in this e-mail shall bind Serco in any contract or obligation.

Serco Group plc.  Registered in England and Wales.  No: 2048608
Registered Office:  Serco House, 16 Bartley Wood Business Park, Bartley Way,
Hook, Hampshire, RG27 9UY, United Kingdom.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message