2012-02-17 14 views
2

使用此命令使用碼頭亞軍java -jar prject123/web/target/dependency/jetty-runner.jar project123/web/target/*.war由jetty runner啓動的web應用程序不能使用jstl標記?

JSTL的代碼,我是如此簡單,啓動網絡應用程序:<c:out value="hi there"></c:out>,源代碼,我從提供網頁得到的是<c:out value></c:out>如此看來,JSTL標籤完成未解析。

我應該提到比使用碼頭亞軍,其他的方式來啓動Web應用程序,其他似乎與JSTL標籤很好地工作,例如mvn -pl project123/web jetty:run-exploded

我有這個問題得到真正的掙扎。任何建議將不勝感激!

回答Daniel的問題: 我使用8.1.0.RC4作爲jetty-runner和maven碼頭插件。另外我在我的pom文件中包含了jstl 1.2。

 <dependency> 
     <groupId>jstl</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 

而JSP網頁源代碼是

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd"> 

<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>JSP Page</title> 
    </head> 
    <body> 
     <h1>Hello!!</h1> <c:out value="you!"> </c:out> 
    </body> 
</html> 
+0

您是否使用與maven-jetty-plugin相同版本的jetty-runner?可能是你正在使用的老碼頭跑步者。你能否在pom.xml中粘貼一個示例JSP頁面和依賴關係? – Daniel 2012-02-21 16:59:15

回答

2

java --lib project123/web/$PATH_TO_THE_LIB -jar prject123/web/target/dependency/jetty-runner.jar project123/web/target/*.war

--lib告訴碼頭轉輪加載罐子在指定的路徑。

0

我想你也需要標準的標籤庫的依賴

<dependency> 
     <groupId>taglibs</groupId> 
     <artifactId>standard</artifactId> 
     <version>1.1.2</version> 
    </dependency> 

,也許改變JSTL依賴關係的javax.servlet?

<dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.1.2</version> 
    </dependency> 
相關問題