JSP works, JSTL doesn't

R

Robert Metzger

I am trying to use JSTL with JSP.
I have Tomcat 4.1.31 installed and it responds properly to access
..jsp's for my application. It processes pages with standard JSP tags
(such as jsp:include) correctly.

However, when I try to use JSTL tags, either to access the standard-examples,
or to access my application, I get errors.

I am following the instructions in
java.sun.com/developer/technicalArticles/javaserverpages/faster/index.html
"Faster Development with JavaServer Pages Standard Tag Library"

I have installed jakarta-taglibs-standard-1.1.2, and copied jstl.jar and
standard.jar to ../webapp/myappname/WEB-INF/lib

For example, I click through to standard-examples/elsupport/Out.jsp
and get the following message:

org.apache.jasper.JasperException:
This absolute uri (http://java.sun.com/jsp/jstl/core) cannot be resolved in
either web.xml or the jar files deployed with this application

Checking

.../web/jakarta-tomcat-4.1.31/webapps/standard-examples/WEB-INF/lib
jstl.jar
standard.jar

.../web/jakarta-tomcat-4.1.31/webapps/myappname/WEB-INF/lib
jstl.jar
standard.jar

The files are identical between the directories.

If I access the following stub page from my application

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<body>
<c:eek:ut value="${header['User-Agent']}"/>
</body>
</html>

I get the following error message:

org.apache.jasper.JasperException:
/e.jsp(4,0) No such tag out in the tag library imported with prefix c

Thanks for any suggestions on getting JSTL working.
 
T

Tor Iver Wilhelmsen

I have installed jakarta-taglibs-standard-1.1.2, and copied jstl.jar and
standard.jar to ../webapp/myappname/WEB-INF/lib

But have you also added a taglib.tld to the app and altered web.xml to
point at the taglib?
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

This should be complemented by

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tlds/jstl.tld</taglib-location>
</taglib>

or the like in your webapp.
 
U

Ulrich Hobelmann

Tor said:
But have you also added a taglib.tld to the app and altered web.xml to
point at the taglib?

Where do you get the .tld? And why doesn't any documentation or
tutorial mention this? (just wondering, since I got the same error, and
nobody knew a solution)
This should be complemented by

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tlds/jstl.tld</taglib-location>
</taglib>

or the like in your webapp.

So you need to create a tld file? What does it look like?
 
T

Tor Iver Wilhelmsen

Ulrich Hobelmann said:
Where do you get the .tld?

In the distribution.
And why doesn't any documentation or
tutorial mention this?

Sun's tutorial does:

http://www.developer.com/java/ejb/article.php/1447551

"Copy the JSTL TLD files to Tomcat's web-inf directory.

The web-inf directory is likely at this location: C:\Program
Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF. If you examine the JSTL
distribution files, you should notice eight files that end with the
TLD extension. All eight files should be copied to your web-inf
directory."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JSTL config question 10
JSTL attempt in JSP 5
JSTL database access 0
jstl ? 0
JSTL error 1
jstl and c:out value not being evaluated 3
View page without JSTL 2
JSTL c:loop works but c:out doesn't 2

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top