As long as we're experimenting here :) , you could even have a method
that takes a hashmap and a class, and uses reflection to load up all the
"static final int" constants into the hashmap.

> -----Original Message-----
> From: Karr, David [mailto:[EMAIL PROTECTED]]
> 
> It's a little more verbose, but you might also consider 
> having a servlet
> context Hashmap attribute, called "constants", perhaps, and your app
> setup would put all your constants into the map, so you would 
> reference
> it like this:
> 
>   '${constants["MY_KEY"]}'
> 
> Actually, if you assume that all of your constant names have no spaces
> in them (I guess that's reasonable :) ), you could also do:
> 
>   "${constants.MY_KEY}"
> 
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> > 
> > On Wed, 20 Nov 2002, David Graham wrote:
> > 
> > > Date: Wed, 20 Nov 2002 15:02:22 -0700
> > >
> > > But what is the EL expression to get a constant like 
> > Constants.MY_KEY?
> > >
> > 
> > What I would do is have my app setup code save the value of
> > Constants.MY_KEY as a servlet context attribute such as 
> > "MY_KEY".  Then,
> > the expression to access it would be the obvious one:  "${MY_KEY}".
> > 
> > > David
> > >
> > 
> > Craig

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

Reply via email to