I’m having some issues with Jetty7 standalone and my spring web app using jsp/jstl/el.
While using maven jetty-plugin everything works fine, but as soon I switch to Jetty standalone, all EL messages eg. ${foobar} are ignored, as well as spring tags.
My example JSP
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<spring:message var="document_title" code="navigation.activity" />
<spring:message var="header_title" text="" code="navigation.activity" />
hello ${hello}
is loaded through spring MVC controller
@RequestMapping(value = "")
public String test(Model model) throws IOException {
model.addAttribute("hello", "world");
return "html/example";
}
web.xml:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
...
tried with and without the following dependencies:
<dependency>
<groupId>taglibs</groupId>
<artifactId>fmt</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
<type>tld</type>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>c</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
<type>tld</type>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
I even tried to enable EL from within JSP via <%@ page isELIgnored="false" %>, but then I get exceptions like these:
An error occurred at line: 21 in the jsp file: /WEB-INF/template/html/example.jsp
Generated servlet error:
/tmp/jetty-0.0.0.0-8080-test.war-_-any-/jsp/org/apache/jsp/WEB_002dINF/template/html/example_jsp.java:268: cannot find symbol
symbol : method proprietaryEvaluate(java.lang.String,java.lang.Class<java.lang.String>,javax.servlet.jsp.PageContext,<nulltype>,boolean)
location: class org.apache.jasper.runtime.PageContextImpl
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${hello}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
I’ve gone through tons of pages, issues on the web and could not fix this yet.
Hope anyone is able to help me out. Thanks in advance!
Not sure what fixed my issue, but I removed all the jsp/jstl dependencies from pom and set web.xml to 3.0.
and all of a sudden it started working.