> I thought I liked the idea of having the taglib in the web.xml file. 
> When I try it I'm getting "This absolute uri 
> (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or 
> the jar files deployed with this application". Do I have to download it 
> somewhere in order to use it in the web.xml file? Any ideas?

:-)

OK, four things when dealing with ANY tag library:

1. PLACE JAR FILES

Place JAR files that hold implementation of the tag library in a directory where 
Tomcat will pick it up. Either make it "WEB-INF/lib/" (private) or 
"${CATALINA_HOME}/shared/lib" (all web-apps will have access to it). You could place 
it in "${CATALINA_HOME}/common/lib", but I don't see the point in Tomcat having access 
to those JARs. There was a discussion recently naming pros/cons of each choice 
(Craig), so look up the archives.

2. PLACE TLD

Place TLD files (Tag Library Descriptor) in either "WEB-INF/" or (if I recall 
correctly) "WEB-INF/taglibs/". The first placement will require for "location" in 
"web.xml" file to be absolute: "/WEB-INF/<name>.tld", while the second will allow for 
relative links: "<name>.tld"

3. DECLARE TLD IN WEB.XML

This part you've already seen.

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

4. DECLARE TLD USAGE IN JSP

This you've seen

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

The prefix is up to you.

Nix.

Reply via email to