Today, when I used the jstl tag library in JSP, I encountered a very disgusting problem. I remember when I took this course at school a few years ago, I have never encountered this kind of problem. It's really disgusting to see it now.
Generally, the following error occurs when you are not careful:
The absolute URI: http://java.sun.com/jstl/core cannot be resolved. An example such as: http://stackoverflow.com/questions/4928271/jstl-1-2-the-absolute-uri-http-java-sun-com-jstl-core-cannot-be-resolved
Solution:
If your project is managed using Maven, you can easily add the following content to the Pom. xml file:
<Dependency> <groupid> jstl </groupid> <artifactid> jstl </artifactid> <version> 1.1.2 </version> </dependency> <groupid> taglibs </ groupid> <artifactid> Standard </artifactid> <version> 1.1.2 </version> </dependency>
Then add the following in your JSP file:
<% @ Taglib prefix = "C" uri = "http://java.sun.com/jsp/jstl/core" %>
OK.
Of course, if your project is not managed using Maven, You can manually add support. The specific method is:
First go to http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/ downloadThe release file of the standard tag library.
To use the java standard tag library in JSP, You need:
1. Copy the TLD file to the WEB-INF/TLD
2. Copy JAR file to WEB-INF/lib
A simple example is as follows:
<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8 "%> <% @ taglib uri ="/WEB-INF/TLD/c-rt.tld "prefix =" C-RT "%> <HTML>
Note that the above exampleCodeThis line:
<%@ Taglib uri = "/WEB-INF/TLD/c-rt.tld" prefix = "C-RT" %>