JSTL 2.0 - Jakarta taglib URIs
- Details
- Written by Nam Ha Minh
- Last Updated on 06 March 2024   |   Print Email
1. taglib directive for using core tags
With JSTL 1.2, the directive to use core tags is:<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
And in JSTL 2.0, it should be:<%@ taglib prefix="c" uri="jakarta.tags.core" %>
Got the difference?
2. taglib directive for using format tags
To use format tags in JSTL 1.2, you declare the following taglib URI:<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt " %>
Now it should be as follows in JSTL 2.0:<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %>
3. taglib directive for using function tags
The following taglib directive is declared for using function tags in JSTL 1.2:<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fn" uri="jakarta.tags.functions" %>
4. taglib directive for using SQL tags
To use SQL tags in JSTL 1.2, the following taglib directive should be declared:<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
And with Jakarta Standard Tag Library, you should use the following:<%@ taglib prefix="sql" uri="jakarta.tags.sql" %>
5. taglib directive for using XML tags
JSTL XML tags can be used given the following taglib directive declared in a JSP page:<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
If migrated to Jakarta XML tags, use the following declaration:<%@ taglib prefix="x" uri="jakarta.tags.xml" %>
Hope you find this post helpful in Java web development with JSP and JSTL.Learn more:
About the Author:
 Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Comments