Re: Referencing constants in EL

2003-03-29 Thread David M. Karr
 Adam == Adam Sherman [EMAIL PROTECTED] writes:

Adam How can I use the Expression Language to reference constants like
Adam Application.CONSTANT Strings and the like?

This has been asked numerous times, probably just as often on the taglibs-user
list as on this list.

The EL references JavaBeans properties, Collections, and Maps.  That's it.  If
you want to reference static variables, you'll have to convert them to a form
that the EL can reference.

One portable strategy would be to build a class that when instantiated, takes
another class, and it uses reflection to store all the static variables defined
in that class into a map, where the keys are the variable names and the values
are the variable values.  You can then reference that map from the EL.

--
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com


Re: Referencing constants in EL

2003-03-29 Thread Adam Sherman
On 03/29/03 17:01:13 -0800 David M. Karr wrote:

Adam How can I use the Expression Language to reference constants
like Adam Application.CONSTANT Strings and the like?
This has been asked numerous times, probably just as often on the
taglibs-user list as on this list.
The EL references JavaBeans properties, Collections, and Maps.  That's
it.  If you want to reference static variables, you'll have to convert
them to a form that the EL can reference.
One portable strategy would be to build a class that when instantiated,
takes another class, and it uses reflection to store all the static
variables defined in that class into a map, where the keys are the
variable names and the values are the variable values.  You can then
reference that map from the EL.
Sorry about that. I guess I could put all my constants into application
scope as well.
Thanks,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST.
Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com