Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts : Using hashmap with html:options

843836Jul 10 2005 — edited Jun 22 2007
Hi guys

I need some help with using hashmap with html: options.

I have a hashmap in which i am storing the customerID as the key and the customerBean Object as the value

// customerBean is a regular java bean with getter and setter methods like getCustomerID, getCustomerName

HashMap hashmap = new HashMap();
hashmap.put(customerBean.getCustomerID(),customerBean);
session.setAttribute("customers",hashmap);

In the jsp file, how do I use it with <html: options> tag
Something like this which does not work

<html: options collection="customers" property="customerID" labelProperty="customerName"/>;

I've been able to use vectors successfully, but i'm having difficulty with hashmaps.
Thanks for your help
Gub
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2007
Added on Jul 10 2005
3 comments
266 views