wood burning stoves 2.0*
The moose likes JSP and the fly likes Custom Tag Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Custom Tag Problem" Watch "Custom Tag Problem" New topic
Author

Custom Tag Problem

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi All,

When I add taglib to my web.xml file, my entire web.xml is invalid - resources not found for anything including servlets that worked before. When I comment out tablib the servlets that worked before are working again.

Code is below.

Can somone spot why this is happening?

Thanks,

Lou

[b]C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\webdev\WEB-INF\web.xml/b]
taglib on lines 39-42


C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\webdev\WEB-INF\appdev.tld


C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\webdev\CustomTags.jsp


Source for C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\webdev\WEB-INF\classes\exercises\tags\StringTag.class
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

I can't see anything overt, but why are you adding the tld declaration to the web.xml at all? It's no longer necessary, and is in fact, discouraged. (unless you are using a really old version of the servlet container.)

By simply giving the tld a valid URI, placing the tld under WEB-INF, and referencing the URI correctly* from the JSPs, the container will auto-find the tld without any goop in the deployment descriptor.





* Your declared URI and referenced URI do not match.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi Bear,


I can't see anything overt, but why are you adding the tld declaration to the web.xml at all? It's no longer necessary, and is in fact, discouraged. (unless you are using a really old version of the servlet container.)


Because that's the instructions in the tutorial, perhaps the tutorial is old.

I comment out


and I get

org.apache.jasper.JasperException: The absolute uri: http://www.appdev.com/taglib cannot be resolved in either web.xml or the jar files deployed with this application


Here's the manifest from
C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar
Doesn't look old.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.0
Created-By: 1.6.0_20-b02 (Sun Microsystems Inc.)
X-Compile-Source-JDK: 1.6
X-Compile-Target-JDK: 1.6

Name: javax/servlet/
Specification-Title: Java API for Servlets
Specification-Version: 3.0
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
Implementation-Version: 3.0.FR
Implementation-Vendor: Apache Software Foundation

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
Hi Bear,

I posted my reply and then noticed

* Your declared URI and referenced URI do not match.


I looked at that several times but still didn't see it.

A quick change and it works without taglib in the web.xml.

I can't see anything overt, but why are you adding the tld declaration to the web.xml at all? It's no longer necessary, and is in fact, discouraged. (unless you are using a really old version of the servlet container.)


Thank you for the additional information!

Lou
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60748
    
  65

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom Tag Problem
 
Similar Threads
Problem with my first struts application
Problem with my first struts application
Servlet action is not available
<error-page> tag issue
JSTL & Servlet-mappings in web.xml