The Struts tag libraries are nothing more than a specialized set of JSP custom tags. JSP custom tags are a fundamental part of JSP development in general. Some of the advantages of using tag libraries are
They enable you to extend and customize JSP functionality
They provide a way to avoid using Java scriptlets in your programs by enabling you to embed Java code inside a custom tag
They make it easier for non-Java coders to maintain JSP files because understanding how to use a tag is easier than understanding scriptlets
JSP custom tags are created by writing Java code that implements the Tag or BodyTag interface (defined in the package javax.servlet.jsp.tagext).
JSP custom tag development involves three basic steps:
1. | |
2. | |
3. |
Note
For a good, basic introduction to JSP custom tag development, you can refer to Sams Publishing’s JavaServer Pages 2.0 Unleashed (ISBN: 0-672-32438-5).
In addition, Sun Microsystems has published a short tutorial at http://java.sun.com/products/jsp/tutorial/TagLibrariesTOC.html.