You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Bate <an...@serco.com> on 2004/02/23 11:47:01 UTC

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: andrew.bate@serco.com


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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Problem updating bean from multi-select box

Posted by Andrew Hill <an...@gridnode.com>.
Are you making sure that the MyBean instance exists when the form is
submitted?

-----Original Message-----
From: Andrew Bate [mailto:andrew.bate@serco.com]
Sent: Monday, 23 February 2004 18:47
To: 'struts-user@jakarta.apache.org'
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: andrew.bate@serco.com


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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



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