• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AdvisorTagHandler unable to compile

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sirs

I am testing out one of the examples in HFSJ for a custom tag handler.


JSP looks like this:


The simple tag handler looks like this



...and my TLD looks like this, placed in WEB-INF:




The .java file compiles, but when I try to access the jsp I get an exception report with following:



It appears as though the container expects me to implement all methods in the interface Tag when all I want to do is extend the class SimpleTagSupport.

My server is Apache Tomcat/6.0.14. JSP version is 2.0 (or at least it came with Tomcat).

I would appreciate any advice.

This is not urgent ;-)

Cheers
Reidar
 
Sheriff
Posts: 67746
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
Is your web.xml declared properly as a Servlets 2.4 (or 2.5) application? Or does it use the 2.3 DTD?
 
Reidar Gjerstad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear

My web.xml is using Servlets 2.4. I tried to change to 2.5 since Tomcat 6.0 seems to require 2.5. I stopped and restarted Tomcat. No change in behavior. Tried several times.

Here's the XSD (XML Schema Definition) part of my web.xml, now using 2.5:



This starts to bug me since I try to study for the exam.

Any other ideas?

Cheers
 
Reidar Gjerstad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again

I solved the problem. I had a copy of jsp-api.jar in my ...appname\WEB-INF\lib directory. jsp-api.jar does indeed contain the class SimpleTagSupport. Removing jsp-api.jar solved the problem. Probably it was copied there during earlier troubleshooting.

Thanks for patience.

Cheers
Reidar
 
Bear Bibeault
Sheriff
Posts: 67746
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
Oy!!!

Yes, having jsp-api.jar in your WEB-INF/lib can cause all sorts of problems. This is not one that I've seen before (others happen often enough that it's easy to recognize them).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Thread hi-jack removed. Please as your own questions in your own topics.]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Reidar Gjerstad wrote:Hi again

I solved the problem. I had a copy of jsp-api.jar in my ...appname\WEB-INF\lib directory. jsp-api.jar does indeed contain the class SimpleTagSupport. Removing jsp-api.jar solved the problem. Probably it was copied there during earlier troubleshooting.

Thanks for patience.

Cheers
Reidar


thank you very much.Although i am from china.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Reidar Gjerstad wrote:Hi again

I solved the problem. I had a copy of jsp-api.jar in my ...appname\WEB-INF\lib directory. jsp-api.jar does indeed contain the class SimpleTagSupport. Removing jsp-api.jar solved the problem. Probably it was copied there during earlier troubleshooting.

Thanks for patience.

Cheers
Reidar



but how can the class that extends SimpleTagSupport be built without adding jsp-api.jar to the build path. We need that class to create our tag support class. Something is going wrong
 
Bear Bibeault
Sheriff
Posts: 67746
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

lakshmanan anand wrote:but how can the class that extends SimpleTagSupport be built without adding jsp-api.jar to the build path. We need that class to create our tag support class. Something is going wrong


This has nothing to do with the build path. WEB-INF/lib is part of the run-time path -- not the build path.

The container provides the servlet and JSP APIs. Copying the jar file to WEB-INF/lib causes all manner of problems such as those discussed here. Don't do it.

 
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic