I am writing a web application that runs within an embedded Jetty instance.
When I attempt to execute a JSTL statement, I receive the following exception:
org.apache.jasper.JasperException: /index.jsp(1,63) 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 have the following jars on the classpath
My web.xml looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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 h77p://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>test</display-name>
</web-app>
My code looks like this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<h2>Hello World!</h2>
<%= new java.util.Date() %><br/>
${1+2}<br/>
<c:out var="${5+9}"/><br/>
</body>
</html>
I started my embedded Jetty server like this:
Server server = new Server(80);
WebAppContext context = new WebAppContext("pig-1.0-SNAPSHOT.war","/");
server.addHandler(context);
server.start();
I spent the past two days experimenting with various combinations of jar files, web.xml configurations, and tag library declarations, but to no avail.
How can I get an embedded Jetty server up and running with full JSTL support?
Jetty 8.0, which has pushed as the default when you use jetty:run, has servlet API 3.0. As of that version of the standard, JSTL standard is supposed to be included, and these taglibs cannot be in the webapp classpath, only the standard classpath. However, 8.0.0.M0 forgot to include them.
Specifying 7.1.4.v20100610 helped for me.