Adding JSTL to jsp (Tomcat 8)

I want to use the JSTL library in my jsp. Now I followed the tutorial and he told me to add this line to the jsp page:

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

This gives me an error that cannot resolve taglib with uri and then url.

I am running tomcat 8. My web.xml is as follows:

<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

Does anyone know how to fix this?

+4
source share
2 answers

You need to add jar for the library jstlin your classpath. If you are using maven, add this dependency.

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

Add this to your pom.xml.

+4
source

To fix this problem, you need to follow these steps:

  • jstl *.jar .
  • , taglib jsp:

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

+1

All Articles