I tryied it and worked properly.
In my action I did:
MyFormBean f = (MyFormBean)form;
request.setAttribute("myList",f.getMyList());
and in the JSP I did exactly like noted in the last mails.
But, what if my collection is a field of my form bean? can't I do like the
following?
<html:select property="testselect">
<html:options collection="myFormBean.myList"
property="value" labelProperty="label"/>
</html:select>
I tryied like above but didn't work....
Thanks Regards
________________________________
Dorileo
"Harland, David" <[EMAIL PROTECTED]>
09/06/2005 12:32
Favor responder a
"Struts Users Mailing List" <[email protected]>
Para
"Struts Users Mailing List" <[email protected]>
cc
Assunto
RE: html:select few doubts
This is all you need
<html:select property="testselect">
<html:options collection="COLLECTION" property="value"
labelProperty="label"/>
</html:select>
You can store your Collections in either the
application/session/request/page scope. Be careful which one you store it
in and what names you use as the key as the bean will check them all!!!!!!
property is the name you give to the select.
collection is any type of collection I use ArrayLists.
The objects in your collection must have a getValue method and a getLabel
method.
The name value is optional. Only use it if you want to dynamically set the
option in focus. The object who's key is "TESTSELECTOBJECT" in either the
application/session/request/page scope must have a getTestselect method.
If the value returned by getTestselect method matches a value in one of
the options that option will be in focus.
<html:select property="testselect" name="TESTSELECTOBJECT">
<html:options collection="COLLECTION" property="value"
labelProperty="label"/>
</html:select>
Regards
Dave.
-----Original Message-----
From: Leandro_Dorileo/[EMAIL PROTECTED]
[mailto:Leandro_Dorileo/[EMAIL PROTECTED]
Sent: 09 June 2005 17:01
To: [email protected]
Subject: html:select few doubts
Hi All!
I've never used this tag before and I'm not so good with taglibs then
please correct my mistakes if I commit any.
I got the following example in a recent thread here in this mailing list:
<html:select name="form" property="selectedOption">
<html:options name="form"
property="collectionOfOptionsValues"
labelName=" form" labelProperty="collectionOfOptionsForDisplay"/>
</html:select>
Ok, few things I could already understand, in the html:select tag there
are 2 properties(in this case I know) name and property; name is the form
name and property is a specic attribute in this form bean that is related
to this field;
In the html:options we have name that is the form bean name, property is
my collection, labelName is a field of my bean into the collection, and
labelProperty is the final html option's value and also a field of my
bean, right?;
does name in both tags can be directly found in any scope? I mean if my
form is either in request or session, is it going to be taken? or am I
missing something?
Property in the html:options tag can be any kind of Collection? can it be
java.util.ArrayList? Don't I need to tell the tag wich is the type of the
objects into the collection?
Do I need to use the <bean:define tag to have it working?
As you can see I'm a bit confused of this.
Help is appreciated, thanks regards ;-)
________________________________
Doril�o
This e mail is from DLA Piper Rudnick Gray Cary UK LLP.
The contents of this email and any attachments are confidential to the
intended recipient. They may not be disclosed to or used by or copied in
any way by anyone other than the intended recipient. If this email is
received in error, please contact DLA Piper Rudnick Gray Cary UK LLP on
+44 (0) 8700 111111 quoting the name of the sender and the email address
to which it has been sent and then delete it.
Please note that neither DLA Piper Rudnick Gray Cary UK LLP nor the sender
accept any responsibility for viruses and it is your responsibility to
scan or otherwise check this email and any attachments.
DLA Piper Rudnick Gray Cary UK LLP is a limited liability partnership
registered in England and Wales (registered number OC307847) which
provides services from offices in England, Belgium, Germany and the
People's Republic of China. A list of members is open for inspection at
its registered office and principal place of business 3 Noble Street,
London EC2V 7EE. Partner denotes member of a limited liability
partnership.
DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law Society and is
a member of DLA Piper Rudnick Gray Cary, a global legal services
organisation, the members of which are separate and distinct legal
entities. For further information, please refer to www.dlapiper.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]