aspose file tools*
The moose likes JSP and the fly likes How do I create my own tags under the Servlet 2.4 API? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How do I create my own tags under the Servlet 2.4 API?" Watch "How do I create my own tags under the Servlet 2.4 API?" New topic
Author

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

Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
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

Joined: Jul 20, 2005
Posts: 10288
    
168

SimpleTagSupport

Article on SimpleTagSupport


[My Blog] [JavaRanch Journal]
Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
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

Joined: Jul 20, 2005
Posts: 10288
    
168

The tomcat docs do mention this class. How did you check to see whether this class exists or not?
Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
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

Joined: Jan 10, 2002
Posts: 61764
    
  67

Not a servlet question. Moved to the JSP forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

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
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
TagSupport is not -and has never been- part of servlet-api.jar; it's in jsp-api.jar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do I create my own tags under the Servlet 2.4 API?