Using Custom Tag Libraries in Web Modules

See Also

You can store common functions in a custom tag library and implement them using simple tags rather than writing the Java code directly in your JSP file. This practice makes the JSP file much more readable and isolates it from any underlying implementation changes.

You can add a tag library to a web module from the Custom Tag Library Repository.

Tip The web module's deployment descriptor file, web.xml, is automatically updated to include the new tag library element. The tag library element chooses a default URI based on the file name of the JAR file. This URI is the name that should be used in the <%taglib%> directive in your JSP file.
Adding a tag library .jar file also causes it to be mounted in the Filesystems pane of the Explorer, if its development directory is not already mounted.

For example, here is the code you would add to your JSP file to use the JSP Standard Tag Library conditional tags. The prefix is an arbitrary string that identifies the tag library associated with a particular tag. Within a JSP file, all taglib prefixes must be unique. Since the prefix is arbitrary, you do not need to use the same one each time you reference a particular taglib. However, it is good practice to use the same prefix for a particular taglib within a web module.

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

See Also
Custom Tag Libraries
Using Custom Tags in JSP Files
Creating Custom Tag Libraries

Legal Notices