Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom Tag Problem

 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic