Custom Tag Libraries
Custom tag libraries, added to JSP in Version 1.1, enable developers to encapsulate complex functionality inside of HTML-like tags. Basically, you can write your own action tags. If you remember from earlier in this chapter, actions are JSP tags for using implicit objects and other server-side objects, and for defining new scripting variables. They typically take the form of <jsp: action name/>. A Web developer can use these tags from a custom tag library just like any other HTML or JSP tag.
Using Custom Tag Libraries in JSP
Custom tag libraries are designed to hide complexity behind simple JSP tags. The following JSP code (main.jsp) demonstrates just how simple they are to use:
<%@ taglib uri="tlds/stockPrice.tld" prefix="stock" ...
Get J2EE™ Applications and BEA™ WebLogic Server™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.