2012-11-29 52 views
1

長話短說:使用帶有嵌入式碼頭JSTL,當我得到這個作爲輸出JSTL不與嵌入碼頭評估和碼頭控制檯 - Maven的插件

<html><body><c:if test="false"> 
    strange 
</c:if></body></html> 

長很長的故事:

我的目錄結構:

web-example+ 
      |_src+ 
      |  \_main+ 
      |   \_webapp+ 
      |     |_index.jspx 
      |     |_WEB-INF+ 
      |        \_web.xml 
      \_pom.xml 

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="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="WebExample" 
    version="2.5"> 

</web-app> 

我index.jspx:

<?xml version="1.0" encoding="UTF-8" ?> 
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:parts="urn:jsptagdir:/WEB-INF/tags"> 

<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" /> 

<html><body> 
    <c:if test="${'1' == true}"> 
     strange 
    </c:if> 
</body></html> 

</jsp:root> 

,最後,我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>com.example</groupId> 
<artifactId>web-example</artifactId> 
<packaging>war</packaging> 
<version>0.0.1-SNAPSHOT</version> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.simplericity.jettyconsole</groupId> 
      <artifactId>jetty-console-maven-plugin</artifactId> 
      <version>1.47</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>createconsole</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
<dependencies> 
    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-http</artifactId> 
     <version>8.1.4.v20120524</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-server</artifactId> 
     <version>8.1.4.v20120524</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-jsp</artifactId> 
     <version>8.1.4.v20120524</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-servlet</artifactId> 
     <version>8.1.4.v20120524</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.jetty</groupId> 
     <artifactId>jetty-webapp</artifactId> 
     <version>8.1.4.v20120524</version> 
     <type>jar</type> 
     <scope>compile</scope> 
    </dependency> 
</dependencies> 
</project> 

我認爲這是特定於碼頭,控制檯的maven-plugin的一個問題,因爲當我開始在Eclipse的Web應用程序(使用啓動碼頭我沒有在這裏包括一個小的Java類一切工作正常)。

我已經看過其他的答案,例如,從cannot load JSTL taglib within embedded Jetty serverJSTL not parsed in a JSP page running on an embedded Jetty instance,從而改變頗有些事情讓我得到這麼遠,例如,我爲了不有老的servlet更新碼頭控制檯 - Maven的插件規範代碼,我從/ usr/share/java中刪除了jsp和servlet JAR,我更新了web.xml和index.jspx的XML規範,但是它沒有幫助。

有沒有人有一個想法是什麼問題?

+0

我在想我是否缺少一些依賴項,例如servlet或JSTL API?我試圖向POM添加一些東西(例如,javax.servlet-api和jstl以及org.glassfish.web中的jstl-impl,請參閱http://stackoverflow.com/questions/6094329/tomcat-7 - 和 - JSTL),但沒有幫助。 – Robert

回答

1

我是JettyConsole的創建者,我無法重現您使用您提供的代碼示例描述的問題。

我用你提供的文件內容重新創建了你的目錄結構,運行了一個乾淨的Maven安裝程序,並運行java -jar在所產生的jetty-console戰爭中。

http://localhost:8080/index.jspx 

按預期方式呈現,正確解析JSLT代碼。

http://localhost:8080/ 

渲染的403禁止的,可能是因爲index.jspx是不是你的歡迎,文件列表和Jetty想要隱藏JSP的源代碼。

我想說這個問題應該改進以重現問題,或者關閉。

+0

有沒有關於如何使用JettyConsole的任何文檔? –