This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Custom Tag Problem

 
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
 
Marshal
Posts: 67429
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67429
173
Mac Mac OS X IntelliJ IDE jQuery Java
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic