[opencms-dev] problem with JSTL EL

Martin Kuba makub at ics.muni.cz
Thu Nov 11 10:17:43 CET 2004


Andy Kriger wrote:
> I'm seeing a strange problem that I'm wondering if anyone else has seen. 
> I am trying to use the JSTL c:out tag with expression language to 
> display information stored in the pageContext and request.
> 
> in my JSP
> <c:set value="TEST" var="test"/>
> <c:out value="${test}"/><br>
> <%=pageContext.getAttribute("test")%><br>
> <c:if test="${test}">
> TRUE
> </c:if><br>
> <c:if test="<%="TEST".equals(pageContext.getAttribute("test"))%>">
> TRUE
> </c:if><br>
> 
> what I see
> ${test}
> TEST
> 
> TRUE
> 
> So, the c tags are working (set, out, if all do something)
> But, expression language does not work - the expressions are not being 
> evaluated
> 
> I am running Tomcat 5.0.28 with OpenCMS 6a2 and Java1.4.2
> I installed the jstl-examples webapp and do not see problems with EL there.
> So, I am wondering if anyone has had problems with EL within OpenCms.

This happens because OpenCMS declares itself as Servlet 2.3
application with following web.xml header:

<!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

so the Servlet 2.4 and JSP 2.0 features do not work.
To use them, change web.xml to:


<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
     version="2.4">

i.e. Servlet 2.4 is using XML Schema instead of DTD.


Martin
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: makub at ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------



More information about the opencms-dev mailing list