Hi Arnaud!
The following lines show you an example for optionsCollection - tag:
<html:select property="duration" value="7">
<html:optionsCollection name="searchForm" property="durations" value="days" label="text"
/>
</html:select>
The bean searchForm has got an attribute of type java.util.List called durations (of course
there`s a public method getDurations()).
A duration-object /-item of this list has got two attributes called days and text (that means
getDays() and getText()) which are both of type String.
So that is why I can use optionsCollection, because label and value is part of the same bean.
The Getters have to be created because they will be used by BeanUtils framework.
The property duration of the html:select - tag is an attribute of the form associated with
the Struts action, which is called by submit.
This form bean has nothing to do with searchForm.
Hopefully this helps you out of your chaos.
Michael
-----Ursprüngliche Nachricht-----
Von: Arnaud Vandyck [mailto:arnaud.vandyck@ulg.ac.be]
Gesendet: Freitag, 22. Oktober 2004 15:29
An: Struts Users Mailing List
Betreff: [html:select/optionsCollection] I don't get it! :(
Hi!
It's two days now I'm fighting with <html:options>. I don't understand how I have to
build my bean and how I have to pass the arguments to the tag.
Has my bean to be a Collection? Has it to have an iterator() method? How to write the getters
and setters?
Many thanks for your help!
--
Arnaud Vandyck
http://fosdem.org/
Free and Open Source Developers' European Meeting
February 26-27 2005,
Bruxelles, Belgium
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
|