A P P E N D I X
A
Examples
This appendix describes some examples of custom actions defined using the Tag Extension 
mechanism.  Refer to the JSP technology web site (http://java.sun.com/products/jsp) to 
retrieve a copy of the examples.
Each example is described briefly and the methods that are defined are explained and 
justified.
A.1
Simple Examples
Most tags are likely to be simple encapsulations of some functionality.  The first set of 
examples are of this type and were already introduced in Section 5.1.3; here they are 
described in some more detail.
A.1.1
Call Functionality, no Body
The example of Section 5.1.3.1 is the simplest example:
In this case:
Tag Library Descriptor
Indicates there are 3 mandatory attributes that are only translation time, and 
that FooTag is the handler for tag "foo".
FooTag
FooTag needs only provide a method for doStartTag().  The method 
doStartTag
 performs the desired actions, possibly interact with the 
PageContext data.
The attribute values are exposed as attributes and their values are set 
automatically by the JSP container.
132




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.