You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chalmers, Douglas" <Do...@Petrotechnics.com> on 2001/02/22 13:35:21 UTC
Select/Options Tag
A tag reference can maintain a String from a SELECT statement within a
form bean, but only the ONE actually selected..
How can I maintain ALL the OPTIONS within a SELECT box within a form
bean??
Doug Chalmers
Software Development
Petrotechnics Ltd
Exploration House
Exploration Drive
Aberdeen
707303 (Ext 14)
Re: Select/Options Tag
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Chalmers, Douglas" wrote:
> A tag reference can maintain a String from a SELECT statement within a
> form bean, but only the ONE actually selected..
>
> How can I maintain ALL the OPTIONS within a SELECT box within a form
> bean??
>
This bug was just fixed, so you will need the most current nightly
release. You can now have a property that returns a String array, and use
it to back a SELECT statement that allows multiple options:
<html:select property="foo" multiple="true">
... Use <html:option> and/or <html:options> here ...
</html:select>
and Struts will correctly remember all of the selected values, based on
the contents of your array.
There is a test page (html-select.jsp) in the Struts test application
(struts-test.war) that illustrates how this works.
>
> Doug Chalmers
> Software Development
> Petrotechnics Ltd
> Exploration House
> Exploration Drive
> Aberdeen
> 707303 (Ext 14)
Craig
Re: Select/Options Tag
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Chalmers, Douglas" wrote:
> A tag reference can maintain a String from a SELECT statement within a
> form bean, but only the ONE actually selected..
>
> How can I maintain ALL the OPTIONS within a SELECT box within a form
> bean??
>
This bug was just fixed, so you will need the most current nightly
release. You can now have a property that returns a String array, and use
it to back a SELECT statement that allows multiple options:
<html:select property="foo" multiple="true">
... Use <html:option> and/or <html:options> here ...
</html:select>
and Struts will correctly remember all of the selected values, based on
the contents of your array.
There is a test page (html-select.jsp) in the Struts test application
(struts-test.war) that illustrates how this works.
>
> Doug Chalmers
> Software Development
> Petrotechnics Ltd
> Exploration House
> Exploration Drive
> Aberdeen
> 707303 (Ext 14)
Craig