Hi,

In order to use <html:optionCollection> tag, you have to define and set a
"Collection" type object in your ActionForm. In this object, you'll have
your list.

public class myFormBean extends ActionForm
{
private String idSelected = null;
...
private Collection myList = new ArrayList();
...
}

And the Collection is an object collection, and for example, these objects
could be of the following type:

public class modelCollection
{
 private String labelDescription = null;
 private String value = null;
 ...

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

 public String getLabelDescription(){      return this.labelDescription;
 }

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

 public String getValue(){      return this.value;
 }

}

Then, in your jsp you have to write this:

<html:select property="idSelected">
 <html:optionsCollection name="myFormBean"
                         property="myList"
                         value="value"
                         label="labelDescription"/>
</html:select>

I hope this helps you,

--
Eider


On 8/25/06, Bumia, Nirav (Cognizant) <[EMAIL PROTECTED] > wrote:


Hi can anybody tell me how to use <html:optionsCollection> tag
I want to use it to dynamically generate the list options.

Thanks.

This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on this
e-mail is strictly
prohibited and may be unlawful.

Visit us at http://www.cognizant.com

Reply via email to