Re: [html:select/optionsCollection] I don't get it! :( [shame on me!]

2004-10-25 Thread Arnaud Vandyck
Michael, 

Many thanks for your help.

In fact, I added a Vector to a Vector with the method... add, not addAll!

Fri, 22 Oct 2004 15:46:22 +0200, 
Albrecht, Michael [EMAIL PROTECTED] wrote: 

 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:[EMAIL PROTECTED] 
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Arnaud Vandyck
http://fosdem.org/
Free and Open Source Developers' European Meeting
February 26-27 2005,
Bruxelles, Belgium

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [html:select/optionsCollection] I don't get it! :(

2004-10-22 Thread Arnaud Vandyck
Fri, 22 Oct 2004 15:46:22 +0200, 
Albrecht, Michael [EMAIL PROTECTED] 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
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]'

 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]