I have a similar situation:

I'm trying to display the keys of an enumeration in a drop down list.

The keys are Integers and are stored in a Hashtable
>    reports.put(new Integer(reportID), item);

The function getReportsKeys returns  reports.keys();

I have two questions:

1. Can html:options collection be used with an enumeration?

2. How can I display the list of keys in JSP?
I have this, what should go in ___WHAT_GOES_HERE???____,
I tried intValue   //from the Integer class, but I get
"javax.servlet.ServletException: No getter method for property
reports.reportsKeys of bean com.gs.ed.sh.GLOBAL"

if there's no solution, would I have to create another class call reportID
with getters & setters?
here's the code
                        <bean:define id="ReportIDEnumeration"
name="<%=Constants.GLOBAL_KEY%>" property="reports.reportsKeys"/>
                        <html:select name="filterForm"
property="filter.reportID">
                                <html:option value="-1">--Select Report
Type--</html:option>
                                <html:options
collection="ReportIDEnumeration" property="___WHAT_GOES_HERE???____"
labelProperty="___WHAT_GOES_HERE???____"/>
                        </html:select>          

Thanks,

Dean Chen

-----Original Message-----
From: Leonardo Maciel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:55 PM
To: 'Struts Users Mailing List'
Subject: RE: html:options



insert line <html:option value" "></html:option>

like this:

<html:select property="stateCode">
        <html:option value" "></html:option>
        <html:options collection="states_codes" property="name"
labelProperty="value"/>
</html:select> 

Actually <html:option value" "/> should do




-----Original Message-----
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: html:options


Hi,
 
I want in my drop down a blank record. This needs to be the default. This
provides the user an option to not select anything( It is a null field). 
 
Is it possible to do this other than putting an empty string in the
collection. How to set this blank string as the default(not affecting the
user's selected value in the edit mode)? 
 
I hope I am clear. 
 
Jayaraman

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

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

Reply via email to