Cannot get JSTL core out tag to work, outputs actual expression!!!

I have an issue with the core JSTL library, which means whenever I want to write something into the JSP page, instead of writing the value of the expression as expected, it writes out the actual expression i.e.

<c:out value="${request.remoteHost}"/> -- Results In -- > ${request.remoteHost}

I have setup everything correctly i.e. added the c.tld, modified the web.xml etc. When I modify the tag so it is illegal (i.e. value="XXX" to v="XXX"), I get an error saying the attribute is not supported, so to me this shows the JSTL tags have been setup correctly.

I have included the JSP page below. Anyone got any ideas?

<%@page contentType="text/html"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>

<html>

<head></head>

<body>

<!-- Does not work -->

<c:out value="${pageContext.request.remoteHost}"/>

<c:out value="${request.remoteHost}"/>

<c:out value="${request}"/>

<!-- works -->

<%

out.println(pageContext.getRequest().getRemoteHost());

out.println(request.getRemoteHost());

out.println(request);

%>

</body>

</html>

[1429 byte] By [np1981a] at [2007-11-27 11:47:10]
# 1

well why don't u read it from request headers ?

something like the one below

<c:out value = '${header["host"]}' />

checkout the below article which might help

http://www.phptr.com/articles/article.asp?p=30946&seqNum=7&rl=1

hope that might help :)

REGARDS,

RaHuL

RahulSharnaa at 2007-7-29 18:11:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Someone else had this issue:

http://forum.java.sun.com/thread.jspa?forumID=45&threadID=502330

And it was raised as a bug:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5028319

Based on those 2 posts, I realised that deploying into Tomcat 5+ with a web-app_2.2.dtd web descriptor file, JSTL is disabled. As I can't change the webapp descriptor file version, without a full system retest, I used a suggestion from the forum post for the pages that needed it:

<%@ page isELIgnored="false"%>

As the mod says in the forum post, its in the JSP 2.0 spec (section 3.3.2):

http://jcp.org/aboutJava/communityprocess/final/jsr152/

If you don't want to register to view the specs, the tutorial also mentions it:

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html#wp72527

np1981a at 2007-7-29 18:11:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...