You need to make use of the html:optionsCollection tag
<html:select property="yearOfManufacture">
<html:optionsCollection property="years"/>
</html:select>
In your form bean you need an object that has the properties label and
value. Like this:
public class ComboBoxItem implements Serializable, Comparable {
private String label;
private String value;
// This is the contract for html:optionsCollection, label is what is
// displayed on the form, and value is the code behind it.
public ComboBoxItem(String label, String value) {
this.label = label;
this.value = value;
}
public String getLabel() {
return label;
}
public String getValue() {
return value;
}
public int compareTo(Object o) {...}
Then, in your populate action, you'll set a Collection<ComboBoxItem>
on the form. That should to it.
On 12/8/05, Leung Ping Cheung <[EMAIL PROTECTED]> wrote:
> I think there are many people asking the same question. But I cannot
> find the answer. any web sites have more or less coding example of
> populating a dropdown box or list in a Struts way before the web page
> displays.
>
> Thanks
>
--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader
http://www.jroller.com/page/certifieddanger
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]