0
votes

First of all, I'm a newbie to JSP :). I've been trying to use JSTL today, version 1.2. I included info in my xml and the dependency in the pom. There is also <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> in the jsp.

The error message I get is: /index.jsp(3,15) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

I've been rereading previous forum posts, but nothing helped so far. Actually, different posts suggest different things. So a simple tutorial would be very much appreciated :).

Thanks a TON already! my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">

</web-app>

my index.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> JSTL Functions

<c:out value="this is simply some text" />  

<br>

<dependencies>
    <!-- JUnit to run the tests -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

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

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

    <!-- Velocity templating engine -->
    <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
    </dependency>

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

</dependencies>

structure of the deployed app:

  • test
    • index.jsp
    • META-INF
    • WEB-INF
      • classes
      • lib
        • commons-collections-3.2.1.jar
        • commons-lang-2.4.jar
        • jstl-1.2.jar
        • velocity-1.7.jar
    • web.xml
  • test.war
1
Show us your dependencies declaration, and tell us which jar files are under WEB-INF/lib in the deployed webapp.JB Nizet
I am using jetty 8. The lib folder has: commons-collections-3.2.1.jar commons-lang-2.4.jar jsp-api-2.1.jar jstl-1.2.jar servlet-api-2.5.jar velocity-1.7.jaruser1939358
It would also help if someone could post a simple, working app using JSTL and jetty...all my tries have resulted in the error described above.user1939358
Then that's the problem. The libraries of a Java EE webapp must be in WEB-INF/lib in the deployed (exploded) war file.JB Nizet
I don't understand, jstl1.2. is in the lib file, as I posted, right?user1939358

1 Answers

0
votes

I think there is a bug with jetty8 and JSTL. Using jetty7 instead solved my problem :)