OOPS!  I wasn't paying attention to which list I was on. :(  This
belongs here on struts-user, not struts-dev.

-- 
Wendy Smoak

-----Original Message-----
From: Wendy Smoak 
Sent: Wednesday, October 08, 2003 11:23 AM
To: Dries Plessers; [EMAIL PROTECTED]
Subject: RE: message-resources


Dries Plessers [mailto:[EMAIL PROTECTED] wrote:
> I have a file (countries.properties) which contain all value
> and representations. 
> e.g.: 
> AD=ANDORRA
> AG=ANTIGUA
> AM=ARMENIA
> How can use this resource file to create a html:select 
> where the value equals the countryname and the representation 
> the 2letters within the struts framework ?

Properties implements Map, so if you do the usual to read in a
.properties file, along the lines of...
   ClassLoader cl = MyAction.class.getClassLoader();
   Properties props = new Properties();
   InputStream input = cl.getResourceAsStream( "countries.properties" );
   props.load( props ) ;

Then you should be able to use the 'props' object with the <html:select>
tag.  Not that I've tried it, but it seems like it should work.

Since countries will probably not change during runtime, you could do
this in a ContextListener and put the Map in Application scope.  That
way it'll be there for everyone who needs it.

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

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

Reply via email to