Cannot get JSTL c:out to work - must be something obvious

I am hoping someone can point out what I am doing wrong here.

I have a simple JSP which puts an object into the request, and then tries to print out a String attribute of that object. However, when I direct my browser to the JSP, all i see is the EL expression${account.companyName}, instead of the actual attribute value:Sun Microsystems.

I am using Tomcat 5.5.29 with JDK 1.4.2.

I have put jstl.jar and standard.jar into the %TOMCAT_HOME%/common/lib directory.

This is my JSP:

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

<%@ page import="com.ia.data.Account" %>

<%

Account sun =new Account();

sun.setCompanyName("Sun Microsystems");

request.setAttribute("account", sun);

%>

<html>

<body>

<c:out value="${account.companyName}"/>

</body>

</html>

My web.xml has this:

<taglib>

<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>

<taglib-location>/WEB-INF/c.tld</taglib-location>

</taglib>

Am I missing any information that is needed to solve this issue? Any help would be greatly apprciated. Thanks!

[1472 byte] By [robin.alcatela] at [2007-10-2 6:16:37]
# 1

Hey,

you don't need to add any tld to your web app nor do you need to add an entry in the web.xml file. the jstl.jar can remain in your web app directory. it's really up to you.

it's probably not working because the uri is incorrect. try :

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

you can also read this article :

http://www.oracle.com/technology/pub/articles/andrei_jsptags.html

franck93a at 2007-7-16 13:18:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks Frank - I've got it working. Here's what I've done:

- removed c.tld from my webapps's WEB-INF directory

- changed the URI to http://java.sun.com/jsp/jstl/core

- moved the jstl.jar and standard.jar back into my webapps's WEB-INF/lib directory.

BUT, the thing which seems to really make the difference is adding adding the page directive:

<%@ page isELIgnored="false" %>

I am not sure why isELIgnored is defaulting to true.

robin.alcatela at 2007-7-16 13:18:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
That would be because your web.xml file is declaring itself as version 2.3. You need to update it for the Servlet 2.4 specification.Check out this thread, reply #6: http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0
evnafetsa at 2007-7-16 13:18:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thank you evnafets, it is now working as expected. I now have EL working, without any need for the isELIgnored=false page declaration.My web.xml was actual declaring itself as version 2.2 (I used the blank-struts.war from build 1.2.4 as a starting point for my project).
robin.alcatela at 2007-7-16 13:18:25 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...