Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JSP works, JSTL doesn't

Reply
Thread Tools

JSP works, JSTL doesn't

 
 
Robert Metzger
Guest
Posts: n/a
 
      09-23-2005
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>
<cut 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.
--
Robert Metzger
Hewlett-Packard Company
High Performance Computing Division
 
Reply With Quote
 
 
 
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      09-23-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) (Robert Metzger) writes:

> 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.
 
Reply With Quote
 
 
 
 
Ulrich Hobelmann
Guest
Posts: n/a
 
      09-24-2005
Tor Iver Wilhelmsen wrote:
> (E-Mail Removed) (Robert Metzger) writes:
>
>> 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?


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)

>> <%@ 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.


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

--
My mouth says the words, my brain is thinking monstertrucks.
Joey (Friends)
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      09-24-2005
Ulrich Hobelmann <(E-Mail Removed)> writes:

> 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."
 
Reply With Quote
 
Ulrich Hobelmann
Guest
Posts: n/a
 
      09-24-2005
Tor Iver Wilhelmsen wrote:
> http://www.developer.com/java/ejb/article.php/1447551
>
> "Copy the JSTL TLD files to Tomcat's web-inf directory.


Ah, thanks!

--
My mouth says the words, my brain is thinking monstertrucks.
Joey (Friends)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(struts/JSTL) Setting bean property value with jstl choose compoundresults DaFoot Java 1 10-23-2008 12:42 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Custom JSTL that accepts JSTL expression Robert Mark Bram Java 0 12-15-2004 12:26 AM
using param or out tag inside sql tag (jsp/jstl/tomcat) shahbaz Java 0 10-27-2003 02:46 AM
JSTL: making things easier for JSP coders asj Java 0 08-27-2003 02:20 AM



Advertisments