In order to use <html:select> and <html:options> you must put the
values you want to diaplay in a collection like

 private static ArrayList monthDisplay=new ArrayList();
monthDisplay.add(new org.apache.struts.util.LabelValueBean( "Jan", "0" ));
monthDisplay.add(new org.apache.struts.util.LabelValueBean( "Feb", "1" ));
monthDisplay.add(new org.apache.struts.util.LabelValueBean( "Mar", "2" ));

then store the collection in request,session or application scope like
application.setAttribute("months",monthDisplay));

in the <html:select> option you call the property where you want to
store the result and in <html:options> you should name the collection
e.g.

<html:select property="myVO.someDate.month">
            <html:options collection="months" property="value"
labelProperty="label" />
        </html:select>
Struts will use the values that you have stored in the collection to
render the list. When you select one option, it will store the result
in myVO.someDate.month variable.

On Sun, 19 Sep 2004 07:50:38 -0400, Robert Taylor <[EMAIL PROTECTED]> wrote:
> Is this the actual HTML generated by the .jsp page?
> 
> robert
> 
> 
> 
> > -----Original Message-----
> > From: Priya Jotwani [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, September 19, 2004 7:44 AM
> > To: Struts Users Mailing List
> > Subject: html:select in Struts
> >
> >
> > Hi Guys,
> >
> >
> >
> > I have a JSP Page with two select boxes. When I write the Usual HTML
> > code for the two DropDown, everything seems to be in place. But as soon
> > as I replace <select> and <option> with <html:select> and <html:option>
> > tags, I cannot see any dropdown kinda thing and also, the options come
> > as normal labels in the same line.I have imported the requited .tld
> > files also.Below mentioned is my Code
> >
> > ------------------------------------------------------------------------
> > ---------------------------------------------------
> >
> > <table cellpadding="3" cellspacing="1" border="0">
> >
> > <tr><td width="200"><strong>Select date:</strong></td>
> >
> > <td>
> >
> > <html:select property="Date">
> >
> >    <html:option value="">04/30/2004</html:option>
> >
> >    <html:option value="">03/31/2004</html:option>
> >
> >    <html:option value="">02/28/2004</html:option>
> >
> > </html:select>
> >
> > </td></tr>
> >
> >
> >
> > <tr><td><strong>Select Report Type:</strong></td>
> >
> > <td >
> >
> > <html:select property="reportType">
> >
> >    <html:option value="">SINGLE</html:option>
> >
> >    <html:option value="">MULTIPLE</html:option>
> >
> > </html:select>
> >
> > </td></tr>
> >
> > </table>
> >
> > ------------------------------------------------------------------------
> > ---------------------------------------------------
> >
> > Any Idea as to what could be the Reason ??
> >
> >
> >
> > TIA,
> >
> > Priya.
> >
> >
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to