struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <>
Subject RE: Accessing static field using EL
Date Fri, 20 Feb 2004 16:07:44 GMT
This is a very FAQ.  You should read the JSTL specification.  The EL can
only reference standard JavaBean properties, collections, and maps.  If
you only have a couple of constants to reference, I would put them into
session or application properties in your application init logic.  If
you have many constants, you might consider having a class use
reflection to grab all the constants in a class and put them into a
hashmap, keyed by the variable name.

-----Original Message-----
From: news [] On Behalf Of Eric Seynaeve
Sent: Friday, February 20, 2004 1:25 AM
Subject: Accessing static field using EL

I have problems accessing a static field using the Struts Expression
Language. The goal is to put the names of all the form bean instance
names, ... in static String fields and use those fields throughout as
much files as possible. This to eliminate frantic debugging sessions due
to typo's <g>.

This is a code snippet:
public class SessionNumberForm extends AbisDynaActionForm {
	public static final String SESSION_NUMBER = "sessionNr";


Here I try to access the field:
<html:text property="${SessionNumberForm.SESSION_NUMBER}" />

but it gives following error:
[ServletException in:/WEB-INF/tiles/index.jsp] No getter method for
property ${SessionNumberForm.SESSION_NUMBER} of bean

How could this field be accessed?



To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message