views:

224

answers:

1

Can anyone point me to an example of how to use ServletUnit to test JSP's? Do I need I need to call registerServlet()? If so, what class name do I pass?

A: 

You do not need to registerServlet if you are going use the default Jasper compiler. However, I needed Jasper jars and their dependencies on the CLASSPATH. The Maven dependencies I needed to get a basic JSP to compile and render were:

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

I am stuck in a JDK1.4 project,so you may be able to use newer versions. I haven't gotten standard taglib working yet...