O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Classic tag handler with TWO methods

This example overrides both the doStartTag() and doEndTag() methods, although it could accomplish the same output all within doStartTag(). The point of doEndTag() is that it’s called after the body is evaluated. We don’t show the TLD here, because it’s virtually identical to the previous one, except for some of the names. The tag is declared to have no attributes, and an empty body.

A JSP that invokes a Classic tag

<%@ taglib prefix="mine" uri="KathyClassicTags" %>
<html><body>
  Classic Tag Two:<br>
  <mine:classicTwo />
</body></html>

The Classic tag handler

image with no caption
image with no caption

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required