J
javaguy
I'm writing some JSP pages. I'd like to access some static text:
class myClass {
public static final String PARENT = "PAR";
public static final String CHILD = "CHD";
public static String getChild() { return CHILD; }
...
}
<jsp:useBean id="mine" class="myClass"/>
<c:set var="child" value="${mine.CHILD}"/>
Parent is: <cut value="${myClass.PARENT}"/>
Child is: <cut value="${child}"/>
Child also is: <cut value="${mine.child}"/>
Note that none of this works. The "mine.CHILD" attempt and "myfails
with a warning that
An error occurred while evaluating custom action attribute "value" with
value "${mine.CHILD}": Unable to find a value for "CHILD" in object of
class "myClass" using operator "." (null)
(Tomcat 5.5.4, JDK 1.4.2)
The "mine.child" attempt (calling mine.getChild()) fails silently.
Apparently it returns null and EL converts it to an empty string. Same
thing for "myClass.PARENT".
I know I can get there by using <%= myClass.PARENT %>, but can it be
done through EL alone?
Thanks,
Jerome.
class myClass {
public static final String PARENT = "PAR";
public static final String CHILD = "CHD";
public static String getChild() { return CHILD; }
...
}
<jsp:useBean id="mine" class="myClass"/>
<c:set var="child" value="${mine.CHILD}"/>
Parent is: <cut value="${myClass.PARENT}"/>
Child is: <cut value="${child}"/>
Child also is: <cut value="${mine.child}"/>
Note that none of this works. The "mine.CHILD" attempt and "myfails
with a warning that
An error occurred while evaluating custom action attribute "value" with
value "${mine.CHILD}": Unable to find a value for "CHILD" in object of
class "myClass" using operator "." (null)
(Tomcat 5.5.4, JDK 1.4.2)
The "mine.child" attempt (calling mine.getChild()) fails silently.
Apparently it returns null and EL converts it to an empty string. Same
thing for "myClass.PARENT".
I know I can get there by using <%= myClass.PARENT %>, but can it be
done through EL alone?
Thanks,
Jerome.