views:

2110

answers:

3

I've been checking out Spring MVC tutorial and copied this small JSP code from there:

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

<html>
    <head><title>Training, Inc.</title></head>
    <body>
        <h2><c:out value="${message}" /></h2>
    </body>
</html>

There is a string set for message and the c:out tag just prints literally

${message}

I was hitting my head for a while until I remembered an issue I had before and changed the taglib URI to:

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

This solved my little problem

Some time ago I had a similar issue with XSLT transforming but in that case I had to change from http://java.sun.com/jstl/xml to http://java.sun.com/jsp/jstl/xml

According with this link my spring example should've worked just as I pasted from spring tutorial

The question is: Any of you guys know where is all this taglib URI confusion documented? Why in the some cases I got the last version from http://java.sun.com/jsp/jstl and in other ones I got the last version from http://java.sun.com/jstl

+2  A: 

Yes, it's well known that the URI for taglibs changed between JSTL versions 1.0 and 1.1. If you happen to get examples that use the old standard and try to use them with the new taglib JAR you'll have this problem.

duffymo
+7  A: 

You can find a discussion about this issue here.

kgiannakakis
Good link, thanks! My problem was so simple! Although I loaded servlet-api-2.5 dependency I never checked my webapp version in web.xml and I was using 2.3, doh! Thanks a lot!
victor hugo
A: 

It would be nice to put some reference on the old page with note: hey guys this is obsolate for 1.1...

Igor

Igor007