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

How do I create my own tags under the Servlet 2.4 API?

 
Egil Poma
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've earlier only dealt with the Servlet 2.3 API for creating my own tags. Then I would just extend the "javax.servlet.jsp.tagext.TagSupport" in my tag class, and put the class into a TLD and then put the TLD into web.xml.

But in the Servlet 2.4 API the "javax.servlet.jsp.tagext.TagSupport" is taken away. How do I create my own tags under the Servlet 2.4 API?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
 
Egil Poma
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the SimpleTagSupport link you gave, I should extend "javax.servlet.jsp.tagext.SimpleTagSupport".

When I download the latest Tomcat (5.5) and use the servlet-api.jar provided there (which according to the Tomcat docs is the Servet 2.4 API), that class don't exist.

Am I missing something here?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tomcat docs do mention this class. How did you check to see whether this class exists or not?
 
Egil Poma
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I downoad and unpack Tomcat, I'm looking in the /common/lib/ directory.

I just open up the servlet-api.jar, and check if the "javax.servlet.jsp.tagext.TagSupport" exists.

After some checking it looks like they've put all the tag classes into jsp-api.jar. Looks like I'll need to include that jar in the class path to make it work .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a servlet question. Moved to the JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Egil Poma:

But in the Servlet 2.4 API the "javax.servlet.jsp.tagext.TagSupport" is taken away.


Incorrect. What led you to this erroneous conclusion?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TagSupport is not -and has never been- part of servlet-api.jar; it's in jsp-api.jar
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
TagSupport is not -and has never been- part of servlet-api.jar; it's in jsp-api.jar


Perhaps the point of confusion is that, prior to Tomcat 5, the servlet and JSP APIs were both bundled into the same jar file.

However, anyone who is writing web applications should have a copy of the Servlet and JSP specifications handy, in which case it would be quite clear that even though the SimpleTag mechanism has been added with JSP 2.0, that the "classic" tag handling mechanism provided by Tag and TagSupport is still available.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic