![]() |
VOOZH | about |
JSTL (JavaServer Pages Standard Tag Library) is a collection of custom tags that encapsulate core functionalities commonly used in JSP pages. It helps reduce Java code embedded in JSPs (known as scriptlets) and promotes a cleaner MVC-based web application design.
JSTL is part of the Jakarta EE (formerly Java EE) specification and is supported in all modern servlet containers.
| Library | Prefix | Description |
|---|---|---|
| Core Tags | c | General-purpose tags for variables, flow control, loops, and URL handling |
| Formatting Tags | fmt | For number, date, and message formatting with localization support |
| SQL Tags | sql | For executing database queries and updates (for demo/testing only) |
| XML Tags | x | For parsing and transforming XML documents |
| Function Tags | fn | Contains utility functions for string and collection operations |
To use JSTL in a JSP-based web application, you need to add the JSTL library to your project and declare the required tag libraries in JSP files.
For Maven projects, add the following dependency in pom.xml:
Explanation:
Note: If you are using an older servlet container (Tomcat 9 or earlier), use the javax.servlet.jsp.jstl dependency instead.
After adding the dependency, include the required JSTL tag libraries at the top of your JSP file.
Explanation:
These URIs are standard and fixed identifiers used by JSP to locate JSTL tags. They do not represent actual URLs.
Ensure that: