hi sheetal,

A collection with labelvalue bean in Struts UTIL package would solve populating 
data automatically

in DAO
arlCompany.add(new 
LabelValueBean(resultSet.getString("Company_Name"),resultSet.getString("Company_ID")));

in ACTION

if(arlCompaniesTemp != null && arlCompaniesTemp.size()>0){ //null and size 
check of Company collection
                                        
mainMenuActionForm.setCompanies(arlCompaniesTemp);      //set company details
                                }

in JSP
<html:select property="companyId" size="1" styleClass="inputtype" >
                                        <html:optionsCollection 
name="mainMenuActionForm" property="companies"/>  
                                        </html:select>
-----Original Message-----
From: sheetal [mailto:[EMAIL PROTECTED]
Sent: Friday, August 25, 2006 1:52 PM
To: Struts Users Mailing List
Subject: Re: html:optionsCollection usage


Bumia, Nirav (Cognizant) 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
>   
     Hi,
    Use this snippet
in Action Class
ArrayList<LabelValueBean> deviceIDList = new ArrayList<LabelValueBean>();
request.setAttribute( deviceIDList, deviceIDList);

<JSP PAGE>
<html:select property="deviceId"   >
         <html:options collection=" deviceIDList"
               property="value" labelProperty="label" /> 
           </html:select>


Hope this helps,
-Sheetal


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

Reply via email to