Fri, 22 Oct 2004 15:46:22 +0200,
"Albrecht, Michael" <Michael.Albrecht@tui.de> wrote:
> Hi Arnaud!
Yo Michael!
> 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>
I got something similar:
<html:select name="objectifs"
property="<%= "id[" + indx + "]" %>"
value="<%= "id[" + indx + "]" %>">
<html:optionsCollection
name="objectifs"
property="nomsRubriquesList"
value="id"
label="nom"/>
</html:select>
I got a 'objectifs' bean in the request scope. The bean has a Vector of
'ste.beans.Rubrique'? You can get the 'List' with
'getNomsRubriquesList()' method. In the bean Rubrique, I got 'getId()'
(returns an int) and I got 'getNom()' (String).
The error message I got is:
No getter method available for property nom for bean under name
[ste.beans.Rubrique@566b1f60, ste.beans.Rubrique@569c1f60,
ste.beans.Rubrique@57b6df60, ste.beans.Rubrique@57ac5f60,
ste.beans.Rubrique@57aa5f60, ste.beans.Rubrique@57a7df60,
ste.beans.Rubrique@57dc5f60]'
> 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
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
|