>>>>> "Justin" == Justin Ashworth <[EMAIL PROTECTED]> writes:
Justin> Hope you're all doing well in the new year. Justin> I am just starting to use EL syntax so this question may be very basic. I Justin> have an interface which contains many public static final variables that I Justin> would like to be able to access with the EL tags. For regular tags that Justin> support rtexprvalues, I would just use <html:option Justin> value="<%=Constant.MY_VALUE%>">. How can this be done with the EL tags, Justin> keeping in mind that this is an interface and not a class? Justin> I have tried several different methods. First I tried <html-el:option Justin> value="${Constant.MY_VALUE}"> to no avail. Then I did this: <jsp:useBean Justin> id="con" class="c.d.u.w.ConstantImpl" /> and <html-el:option Justin> value="${con.MY_VALUE}">, which also didn't work. Justin> What am I missing? You should read the JSTL specification to get a clear idea of what you can do with EL expressions. In particular, you can only reference javabean properties, map entries, or collection/array entries. This particular question has come up more than once. That is, the idea of referencing constant values from an interface in EL expressions. There is one sort of bizarre thing you could do to facilitate this without much, if any, hardcoding. The fact that the EL can reference map entries provides for the possibility of having an object that is initialized with a class, which uses reflection to get a list of all of the "static final" fields of the class, and puts all the attribute names and values into a hashmap, with the attribute names as keys. The gnarly reflection and map loading would just happen once. When the EL references map entries, it can look exactly like normal javabean references. If you're determined to reference these constants in EL expressions, this may be the cleanest way to get this done. -- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP; SCWCD -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>