2012-03-14 2 views
0

jsp/jstl/el을 사용하여 Jetty7 독립 실행 형 및 내 스프링 웹 응용 프로그램에 몇 가지 문제가 있습니다. maven jetty-plugin을 사용하는 동안 모든 것이 잘 작동하지만, 곧 Jeot standalone으로 전환합니다. 예를 들어 모든 EL 메시지가 있습니다. ${foobar}은 봄 태그와 마찬가지로 무시됩니다. Jetty7 독립 실행 형 + jstl/jsp + spring 3 = el/spring 태그가 작동하지 않습니다.

내 예 JSP

스프링 MVC 컨트롤러를 통해로드
<%@ 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} 

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

I 페이지의 톤을 겪었어요, 문제를 아직이 문제를 해결하지 못했습니다. 누군가 나를 도울 수 있기를 바랍니다. 미리 감사드립니다!

답변

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

갑자기 작동하기 시작했습니다.