Class 2 |
Intermediate Java 30-IT-397 |
|
More About Tags
-
The most simple tag does not have attributes or a body.
-
To define this, extend javax.servlet.jsp.tagext.TagSupport.
-
Then, override the doStartTag() method. This will be called
when the compiler comes across your first tag.
-
To write data out, you will need to get out via: JspWriter
out = pageContext.getOut();
-
Other important pageContext methods: getRequest(), getResponse(), getServletContext(),
getSession().
-
Be sure to enclose the print method of the out object in a try-catch
block, because it throws IOException.
-
Return the constant SKIP_BODY if your tag does not evaluate the
text between the start and end tags.
Tag JSP Example

Created by: Brandan Jones
December 20, 2001