Hi, 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" size="7"> <html:options name="myFormBean" property="myBean.myCollectionListData"/> </html:select> Error log:- DEBUG 2004-03-01 15:15:39,437 [worker2] [EMAIL PROTECTED] - org.apache.commons.beanutils.BeanUtils Target name = myCollection DEBUG 2004-03-01 15:15:39,447 [worker2] [EMAIL PROTECTED] - org.apache.commons.beanutils.ConvertUtils Convert string 'Lalalalala' to class 'java.util.Collection' DEBUG 2004-03-01 15:15:39,447 [worker2] [EMAIL PROTECTED] - org.apache.commons.beanutils.ConvertUtils Using converter [EMAIL PROTECTED] javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1098) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:816) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at bss.athena.framework.controller.FrameworkServlet.process(FrameworkServlet.ja va:149) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520) at javax.servlet.http.HttpServlet.service(HttpServlet.java:772) at javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at com.persistence.web.JMillConnection.run(JMillConnection.java:1172) at com.persistence.web.JMillConnection.run(JMillConnection.java:292) at com.persistence.web.JMillThreadPool$WorkerThread.run(JMillThreadPool.java:96 ) 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? Thanks, Andrew > -----Original Message----- > From: Andrew Bate > Sent: 23 February 2004 10:47 > To: '[EMAIL PROTECTED]' > 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: [EMAIL PROTECTED] > > 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 viruses. 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]