struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: options thru Map rather than Collection?
Date Wed, 09 Jul 2003 22:13:32 GMT
Alex wrote:
> Is there a way to render select options drop down thru a Map?

Yes.  

<html-el:select property="type">
  <html-el:options collection="contactTypes" property="key"
labelProperty="value"/>
</html-el:select>

contactTypes is a Map (TreeMap so it will sort automatically) placed in
Application scope by a ServletContextListener when the app starts up.

If the key/value objects in your Map aren't themselves Strings, make sure
the toString method returns something useful.  (Or there's probably a way to
convince it to call another method, I haven't needed that.)

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message