struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: EL - can't get access to my constants
Date Wed, 25 Feb 2004 14:17:08 GMT
You haven't shown the EL syntax that you're trying to use.  If you're just trying to reference
normal properties, note that property accessors cannot be static methods, they have to be
normal instance methods.

If you're trying to reference constants, you might be better off putting the constant values
into a map, keyed by the symbol name.  You could either do this manually with a small number
of constants, or automatically using reflection.

I also believe that the JSP 2.0 "function" syntax (which I'm not that familiar with yet) might
allow you to use a static method.

You might be better off asking about this on the taglibs-user list.

-----Original Message-----
From: Axel GroƟ [mailto:kamikaze@iaeste.at] 
Sent: Wednesday, February 25, 2004 3:02 AM
To: Struts Users Mailing List
Subject: EL - can't get access to my constants


dear friends!

i declared a getter method for a constant, but i can't use it using jsp2.0 Expression Language.

public class Constants{
..
public static String getBEAN_PROP_SYSTEM() {
		return BEAN_PROP_SYSTEM;
	}
..
}

in the jsp:
works fine:
 <%= ((Constants)session.getAttribute("constants")).getBEAN_PROP_SYSTEM() %>

[DEBUG] InsertTag - -[ServletException in:/WEB-INF/contents/System.jsp] Unable to find a value
for "BEAN_PROP_SYSTEM" in object of class "at.ftw.struts.Constants" using operator "."'
<javax.servlet.jsp.el.ELException: Unable to find a value for "BEAN_PROP_SYSTEM" in object
of class "at.ftw.struts.Constants" using operator ".">javax.servlet.jsp.el.ELException:
Unable to find a value for "BEAN_PROP_SYSTEM" in object of class "at.ftw.struts.Constants"
using operator "."


i attached the full stacktrace

thanks in advance,
Axel

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message