Using Custom Tags in JSP Files

See Also

The JavaServer Pages (JSP) 1.2 Specification provides for the use of custom JSP tags packaged in a tag library. Custom tag libraries are reusable, readily accessible, and highly distributable.

Tip You must include the appropriate statements in your JSP source file, described below, and add the custom tag library to the web module for the JSP page to use the tags.

To use a custom tag in a JSP file:

  1. Place the tag library JAR file into the /WEB-INF/lib directory of the web module containing the relevant JSP page.
  2. Before referencing a custom tag in your JSP source file, add a taglib directive to the file. The directive requires a URI for the location of the tag library within the web module and a tag prefix used to identify tags from that library.
  3. At any point after the taglib directive, you can use the tag prefix to reference tags from the tag library. For example:

    <%@ taglib prefix="sql"
    uri="http://java.sun.com/jstl/ea/sql" %>
    <sql:transaction dataSource="${myDatasource}">

See Also
Custom Tag Libraries
Adding a Tag Library to a Web Module

Legal Notices