Can not find the tag library descriptor for http java sun com jsp jstl core

0 votes

I have included this at the very top of my JSP page:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

I already placed the JSTL JAR file in the WEB-INF/lib directory. But still, the JSP can't resolve the taglib. I get the below error:

I am using Eclipse Juno and the project structure is shown below:
enter image description here

Feb 17, 2022 in Java by Rahul
• 9,680 points
27,816 views

1 answer to this question.

0 votes

If you have 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 the 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 to 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>

Hope this helps!

Join java training to learn from the expert.

Thanks!

answered Feb 17, 2022 by Aditya
• 7,680 points

edited Jun 22, 2023 by Khan Sarfaraz

Related Questions In Java

0 votes
1 answer

How can we upload the files using JSP/ Servlets in Java?

<form action="upload" method="post" enctype="multipart/form-data"> ...READ MORE

answered Jun 8, 2018 in Java by Sushmita
• 6,920 points
888 views
0 votes
1 answer

Error:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

Hello @kartik, Include servlet-api-3.1.jar in your dependencies. Maven <dependency> ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,840 points
4,333 views
0 votes
0 answers

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path [duplicate]

I have a project created by Maven ...READ MORE

Apr 21, 2022 in Java by Rahul
• 3,380 points
1,607 views
0 votes
1 answer

I am learning looping statements. Can you tell me how 'for-each' works in Java?

While programming we often write code that ...READ MORE

answered Apr 17, 2018 in Java by Rishabh
• 3,620 points
950 views
0 votes
0 answers

Server Tomcat v9.0 Server at localhost failed to start

I am using Tomcat server v9.0 but ...READ MORE

May 23, 2022 in Java by Kichu
• 19,040 points
3,481 views
0 votes
1 answer

How can a war file be deployed in Tomcat 7?

You can access your application from: http://localhost:8080/sample Deploying ...READ MORE

answered Apr 20, 2018 in Java by sophia
• 1,400 points
2,101 views
+5 votes
11 answers

How to import a jar file in Eclipse?

Click on File > Import. The Import ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,140 points
360,199 views
0 votes
1 answer

Which is the best GUI designer for Eclipse?

Windows Builder Pro is the best GUI ...READ MORE

answered May 21, 2018 in Java by Akrati
• 3,190 points
1,799 views
0 votes
1 answer

jQuery fix for "Uncaught TypeError: $ is not a function" error

 Use the following lines of code in ...READ MORE

answered Feb 16, 2022 in Java by Aditya
• 7,680 points
2,138 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP