> -----Original Message----- > From: Timo Neumann [mailto:[EMAIL PROTECTED] > > Hi all, > > I have a class Constants that contains entries like that > > public static final String YES = "yes"; > > I want to access these "constants" in my JSPs with EL, something like: > > <html:radio property="partner" value="${Constants.YES}"/> > > This way it does not work. How would I do it right? > > I've got a workaround that is not very elegant and I would > like to avoid it: > > <c:set var="formRadioYes"><%= Constants.YES %></c:set> > <html:radio property="partner" value="${formRadioYes}"/>
The EL can reference javabeans properties, and collection and map entries. That's it (pre-JSP 2.0). It can't reference static variables. If you have several constants that you want to reference throughout your view side of the application, create a bean in application scope with specific properties, or with a map. It's possible to use reflection to load the "static final" variables from a class into a map. =========================================================================== 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