1 posts in topic
Flat View  Flat View

Posted By:   Dave_Smith
Posted On:   Monday, July 8, 2002 09:18 AM

I have a bean in scope that is a Vector of Strings. I have named the bean 'mstands'. I want to put these Strings (which are not static) into a

Re: <html:select>

Posted By:   Ed_Hoden  
Posted On:   Monday, July 8, 2002 11:19 AM

For the tag, your collection should be made up of a data bean that holds the information to display in the
list. As an example:

public class OptionBean {

private String value = "";

public void setValue( String value ) { this.value = value; }

public String getValue() { return value; }

private String label = "";

public void setLabel( String label ) { this.label = label; }

public String getLabel() { return label; }

public OptionBean() {} }

Populate a collection of these with what you want to display and store it in whatever scope you are using. Then code your
tag like such: .

The reset method only gets called when a form is submitted. That method is intended to clear out form values in
anticipation of having those values set from the request parameters.

To prepopulate a form, include the default values in the default constructor or instantiate your form in advance (in an
action is the way I do it), populate the default values, and store it in whatever scope you are going to use it in under the
same name you specified for the form in the struts-config.xml. -- HTH Ed
About | Sitemap | Contact