Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AdvisorTagHandler unable to compile

 
Reidar Gjerstad
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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).
 
ar sah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Thread hi-jack removed. Please as your own questions in your own topics.]
 
boy-zh kaisa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
lakshmanan anand
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic