Custom tag libraries

A custom tag library is a set of custom tags that invoke custom actions in a JavaServer Pages (JSP) file. Tag libraries move the functionality provided by the tags into tag implementation classes, reducing the task of embedding excessive amounts of Java™ code in JSP pages.

Tag libraries are created by developers who are proficient in the Java programming language. These libraries can be used by web designers who might not know Java, but want to enhance their website by taking advantage of Java encoded tag libraries.

Tag libraries offer the following benefits:
  • Help separate presentation from implementation.
  • Are easy to maintain and reuse
  • Simplify complex actions
  • Provide Java coded functions without the task of coding in Java.
  • Can dynamically generate page content and implement a controlled flow.

You can develop tag libraries yourself or you can download them from existing open source utility tag libraries. For example, you can download tag libraries from sites such as the Jakarta Project, a division of the Apache Software Foundation. Jakarta also offers a tag libraries tutorial on that site.

This product includes the JavaServer Pages Standard Tag Library (JSTL), a library of custom tags that provide the core functionality common to many web applications. If you include the JSF and JSTL project facets in your project, you can select and insert a particular tag from the tag library when you edit the JSP file. (To insert a custom tag, right click in the JSP and select JSP > Insert Custom Tags).

You can add the JSTL library to a project when you create the project by selecting the JSTL project facet from the New Web Project wizard.
Note: If you did not include JSTL when you first created the project, you can add it afterward by selecting Project > Properties > Project Facets.

The web.xml file provides the link between the directive used in the application and the actual JAR file containing the classes that execute the function.

Icon that indicates the type of topic Concept topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: ccusttaglib.html