簡単に言えば、これを出力として取得します
<html><body><c:if test="false">
strange
</c:if></body></html>
埋め込まれた Jetty で JSTL を使用する場合。
長い話:
私のディレクトリ構造:
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>
これは、jetty-console-maven-plugin に固有の問題だと思います。Eclipse 内で webapp を起動するとすべてが正常に機能するためです (Jetty を起動する小さな Java クラスを使用して、ここには含めませんでした)。
私は他の回答を見てきました。たとえば、組み込み Jetty サーバー内でJSTL taglib を読み込めないことや、組み込み Jetty インスタンスで実行されている JSP ページで JSTL が解析されていないことなどから、これまでに取得するのに役立つかなりのものが変更されました。たとえば、更新しましたjetty-console-maven-plugin は古いサーブレット仕様コードを持たないようにするため、jsp とサーブレット JAR を /usr/share/java から削除し、web.xml と index.jspx の XML 仕様を更新しました。しかし、それは役に立ちませんでした。
誰が何がうまくいかないのか考えていますか?