Problem description
An error is reported after importing the required dependencies and referencing the following core tag library. JSTL cannot be used.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Reason:
The dependency jar package is missing in the Tomcat project.
jstl 1.1 | jstl 1.2 | |
---|---|---|
依赖 jar 包 | standard.jar | taglibs-standard-impl-1.2.5.jar taglibs-standard-spec-1.2.5.jar |
solution
Option 1: Add these two dependencies
<!-- https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-spec -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-impl -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
<scope>runtime</scope>
</dependency>
Solution 2: manually import the jar package
you can find these two jar packages in the Tomcat \ webapps \ examples \ WEB-INF \ lib directory, and then copy them to the Lib directory of Tomcat or the Lib directory of the project to solve the problem</ font>
1. Copy to the Lib directory of Tomcat (once and for all)
2. Copy to the Lib directory of the project (only valid for this project)
About importing external jar packages in the project, you can see importing external jar packages in eclipse and idea