14.2. Defining a Basic Tag
This section gives details on defining simple tags without attributes or tag bodies; the tags are thus of the form <prefix:tagname />.
The Tag Handler Class
Tags that either have no body or that merely include the body verbatim should extend the TagSupport class. This is a built-in class in the javax.servlet.jsp.tagext package that implements the Tag interface and contains much of the standard functionality basic tags need. Because of other classes you will use, your tag should normally import classes in the javax.servlet.jsp and java.io packages as well. So, most tag implementations contain the following import statements after the package declaration:
import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; ...
Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.