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 [mailto:[EMAIL PROTECTED] On Behalf Of Eric Seynaeve
Sent: Friday, February 20, 2004 1:25 AM
To: [EMAIL PROTECTED]
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
org.apache.struts.taglib.html.BEAN'

How could this field be accessed?

Thanks,

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to