Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Custom Tag Problem

 
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67651
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67651
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic