[java] Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

I'm trying to use JSTL, but I get the following error:

Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

How is this caused and how can I solve it?

This question is related to java jsp jstl

The answer is


you need to configure this in web.xml as well.Please refer below code.

<taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/lib/c.tld</taglib-location>
</taglib>

Please let me know if you still face any issue.


This is a very common error while working on JSTL.

To solve this error simply :-

  1. Download jstl-1.1.2.jar and standard-1.1.2.jar
  2. And then just paste them in lib folder under WEB-INF of your Dynamic Web App project.

You will find the error has gone now!

Hope this helps.


I got the same error message (Eclipse Enterprise 2020-06, Tomcat 8.5, dynamic web project), even after I downloaded version 1.2.5 of the jst library (here), dropped it into the "WEB-INF/lib" folder and added <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> to the very top of the jsp file.

Using version 1.2 (here) instead fixed it.


To make it work:

Add jstl and standard jar files to your library.

Hope it helps.. :)


What worked for me (I use Java 8 and Tomcat 9 in Eclipse 2019):

pom.xml

    <!-- jstl -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>javax.servlet.jsp.jstl-api</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>

.jsp file

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>

create a libs folder in the inside WEB-INF directory and add jstl, standard jars as below.enter image description here


Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”

Based on one of your previous questions you're using Tomcat 7. In that case you need JSTL 1.2. However, you've there a jstl.jar file while JSTL 1.2 has clearly the version number included like so jstl-1.2.jar. The sole filename jstl.jar is typical for JSTL 1.0 and 1.1. This version requires a standard.jar along in /WEB-INF/lib which contains the necessary TLD files. However, in your particular case the standard.jar is clearly missing in /WEB-INF/lib and that's exactly the reason why the taglib URI couldn't be resolved.

To solve this you must remove the wrong JAR file, download jstl-1.2.jar and drop it in its entirety in /WEB-INF/lib. That's all. You do not need to extract it nor to fiddle in project's Build Path.

Don't forget to remove that loose c.tld file too. It absolutely doesn't belong there. This is indeed instructed in some poor tutorials or answers elsewhere in the Internet. This is a myth caused by a major misunderstanding and misconfiguration. There is never a need to have a loose JSTL TLD file in the classpath, also not in previous JSTL versions.

In case you're using Maven, use the below coordinate:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

You should also make sure that your web.xml is declared conform at least Servlet 2.4 and thus not as Servlet 2.3 or older. Otherwise EL expressions inside JSTL tags would in turn fail to work. Pick the highest version matching your target container and make sure that you don't have a <!DOCTYPE> anywhere in your web.xml. Here's a Servlet 3.0 (Tomcat 7) compatible example:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">

    <!-- Config here. -->

</web-app>

###See also:


The URI depends on the version of JSTL you are using. For Version 1.0 use:

http://java.sun.com/jstl/core

and for 1.1 (and later), you need to use:

http://java.sun.com/jsp/jstl/core

I had the same problem even after I added jar files for jstl and standard. For me, it resolved after I added a Targeted runtime for my project.

Go to Project Properties > Targeted Runtimes and select the server you are using (Tomcat 7.0 for me).


Downloading jstl-1.2.jar instead of jstl.jar solves the problem


You just need to include the standard.jar file in your project build path.


You may try to make the folder which include jsp-s become the source folder of eclipse, that solved the same problem of mine. As below:

  1. open project's properties.(right click project, then choose the Properties)
  2. choose Java Build Path, select the Source tab, click Add Folder and choose the folder including your jsp-s, OK

If you are using maven your pom's <dependencies> tag should look like:

<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>javax.servlet.jsp.jstl-api</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
</dependencies>

It works for me.


Simply download javax.servlet.jsp.jstl.jar and add to your build path and WEB-INF/lib if you simply developing dynamic web application.

When you develop dynamic web application using maven then add javax.servlet.jsp.jstl dependency in pom file.

Thanks

nirmalrajsanjeev


Well, I have read this post and seems it is not good enough to fix this issue.

Spring based application on the tomcat 8 will not work.

Here is the solution

Step 1 ? Add the following dependency in your pom.xml

<!-- JSTL Support -->

     <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>
<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>javax.servlet.jsp-api</artifactId>
    <version>2.3.1</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

Step 2 ? Add All following two statement in your JSP page, ensure that you are using isELIgnored="false" attribute in <%@ page %> tag

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" isELIgnored="false" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

Step 3 ? Remove all the other configuration that you have done till now in web.xml or anywhere else :)

Step 4 ? Clean the Tomcat and restart Tomcat.

Side Note ? Actually, JSTL will work with only 3.x Servlet specifications on Tomcat 8.

[http://www.kriblog.com/j2ee/jsp/jstl-with-spring-4-on-tomcat-8.html]

I had same problem and despite having jstl

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

I had to add 'standard' as well:

<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.1.2</version>
</dependency>

Also, as mentioned in previous post:


Make sure that both the below jars are present in the build path:

  1. standard-1.1.2.jar
  2. jstl-api-1.2.jar

Maven Dependencies are:

<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>jstl-api</artifactId>
    <version>$1.2</version>
</dependency>

<dependency>
   <groupId>taglibs</groupId>
   <artifactId>standard</artifactId>
   <version>1.1.2</version>
</dependency

add the maven dependencies:

<dependency>
  <groupId>jstl</groupId>
  <artifactId>jstl</artifactId>
  <version>1.2</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>taglibs</groupId>
  <artifactId>standard</artifactId>
  <version>1.1.2</version>
  <scope>compile</scope>
</dependency>

This works as well:

<dependency>
    <scope>compile</scope>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>jstl-api</artifactId>
    <version>1.2</version>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

so used jstl 1.2 instead of standard.jar together with jstl-api 1.2


in your pom.xml just add

    <!-- jstl -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency> 

and try run

mvn eclipse:eclipse -Dwtpversion=2.0

will solve the problem


To resolve the issue in jsp we have to use the dependency below in the pom file. If you dont use maven then download the dependency jar and add it to your WEB-INF directory.
<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.1.2</version>
    <scope>compile</scope>
</dependency>

Add this 3 file for runtime support as well`

As per snapshot the main reason for error is that you are not defining c.tld in lib folder causes such error.

This lib content information about taglib


I have similar issue, why should we add external jar files when we are using maven?

I have already included jstl maven dependency then also I encounter error "Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"". Then I include following dependency then error get solve, without including any single external jar file.

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
</dependency>

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to jsp

Difference between request.getSession() and request.getSession(true) A child container failed during start java.util.concurrent.ExecutionException The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path Using if-else in JSP Passing parameters from jsp to Spring Controller method how to fix Cannot call sendRedirect() after the response has been committed? How to include js and CSS in JSP with spring MVC How to create an alert message in jsp page after submit process is complete getting error HTTP Status 405 - HTTP method GET is not supported by this URL but not used `get` ever? How to pass the values from one jsp page to another jsp without submit button?

Examples related to jstl

Iterating through a List Object in JSP How to get a index value from foreach loop in jstl Get value from hashmap based on key to JSTL How to use if, else condition in jsf to display image Selected value for JSP drop down using JSTL Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config Adding external resources (CSS/JavaScript/images etc) in JSP Sun JSTL taglib declaration fails with "Can not find the tag library descriptor" How to do if-else in Thymeleaf?