2012-03-14 53 views
0

我在使用jsp/jstl/el的Jetty7独立版和我的spring web应用程序中遇到了一些问题。 虽然使用maven码头插件一切正常,但只要我切换到码头独立,所有EL消息例如。 ${foobar}被忽略,以及春天标签。Jetty7 standalone + jstl/jsp + spring 3 = el/spring标签不工作

我的例子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} 

通过弹簧MVC控制器加载

@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"> 
... 

试图具有和不具有以下依赖性:

<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> 

我甚至试图通过<%@ page isELIgnored="false" %>从内部JSP EL启用,但后来我得到异常这样的:在网络上

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)); 

我已经经历吨的页面消失,问题和无法修复这个呢。 希望任何人都能帮助我。提前致谢!

回答

1

不知道什么解决了我的问题,但是我从pom中删除了所有jsp/jstl依赖项,并将web.xml设置为3.0。

<web-app 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    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" 
    id="Your_Webapp_ID" version="3.0"> 

突然间它开始工作。