3

ServletUnit を使用して JSP をテストする方法の例を教えてもらえますか? registerServlet() を呼び出す必要がありますか? もしそうなら、私はどのクラス名を渡しますか?

4

2 に答える 2

2

デフォルトのJasperコンパイラを使用する場合は、registerServletを使用する必要はありません。ただし、JasperjarとそれらのCLASSPATHへの依存関係が必要でした。基本的なJSPをコンパイルしてレンダリングするために必要なMavenの依存関係は次のとおりです。

<dependency>
  <groupId>tomcat</groupId>
  <artifactId>jasper</artifactId>
  <version>3.3.2</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>tomcat</groupId>
  <artifactId>jasper-compiler</artifactId>
  <version>5.5.23</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>tomcat</groupId>
  <artifactId>tomcat-util</artifactId>
  <version>5.5.23</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>tomcat</groupId>
  <artifactId>core_util</artifactId>
  <version>3.3.2</version>
  <scope>test</scope>
</dependency>

私はJDK1.4プロジェクトで立ち往生しているので、新しいバージョンを使用できる可能性があります。標準のtaglibがまだ機能していません...

于 2009-11-25T17:06:45.113 に答える