Can someone explain what a taglib is in respect to Java programming? It contains a prefix and uri...but what do each of these refer to? I looked up a number of different websites but am frankly am still confused about what it is and what it does.
The prefix attribute defines the prefix that distinguishes tags defined by a given tag library from those provided by other tag libraries. If the tag library is defined with tag files (see Encapsulating Reusable Content Using Tag Files), you supply the tagdir attribute to identify the location of the files.
The taglib Directive Specify a shortcut URI, as defined in a web. xml file (see "Use of web. xml for Tag Libraries" above). Fully specify the tag library description (TLD) file name and location.
This taglib contains tags used to create struts input forms, as well as other tags generally useful in the creation of HTML-based user interfaces.
The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.
The JavaServer Pages API allows you to define custom JSP tags that look like HTML or XML tags and a tag library is a set of user-defined tags that implement custom behavior.
The taglib directive declares that your JSP page uses a set of custom tags, identifies the location of the library, and provides a means for identifying the custom tags in your JSP page.
Original source: JSP - The taglib Directive
The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating existing custom tags with JSTL tags.
The JSTL tags can be classified, according to their functions, into following JSTL tag library groups that can be used when creating a JSP page:
Core Tags
Formatting tags
SQL tags
XML tags
JSTL Functions
Each group of tags has the following core structure:
<%@ taglib prefix="some prefix"
uri="some http URL" %>
More info you can find here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With