Introduction
These guidelines describe when to use JSP custom tags, how to model them, and some applicable design considerations.
For more information on JSP custom tags, see Concept: Java Server Page (JSP) Custom Tag.
Identifying JSP Custom Tags
JSP custom tags are simple Java classes implementing the glue between Java implementation and the JSP pages. Custom
tags are ways of minimizing the use of Java code appearing in JSP pages. In projects where Java development and Web
design must be separated, JSP custom tags can eliminate Java code from the JSP page, hiding the Java code from the Web
designers.
Modeling JSP Custom Tags
JSP custom tags are modeled as simple Java classes. In UML, the stereotype <<JSPTag>> distinguishes them
from other Java classes.
Concurrency
Tag handlers are used by one thread at a time (unlike, for instance, Servlets); however, there may be multiple threads
operating on different instances of custom tags. A developer should be careful accessing shared resources (such as
static data) to avoid concurrency problems.
Cleanup
Tag handlers may be pooled and reused by the Web container. If resources are required, they should be created in
doStartTag() and the developer should implement release() to cleanup the resources before reuse.
|