I know this has been answered a while ago. I could not get the answer from Ben McCann to work for me. However, i had luck by adding JSP support directly to Jetty by adding
<!--jsp support for jetty, add the 2 following -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
<version>6.1.14</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
<version>6.1.14</version>
<type>jar</type>
</dependency>
Strangely, this was not supported by the version 6.1.24 I originally had.
So in total, that made my pom.xml look like this:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>wikiproject</groupId>
<artifactId>wikiproject</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<jetty.version>6.1.14</jetty.version>
</properties>
<!-- Jetty dependencies -->
<dependencies>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<!--jsp support for jetty, add the 2 following -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-antlr</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
and my start class (which i added in folder \src\test\java\com\company\wikiproject
)
package com.company.wikiproject;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
/**
* User: Jesper Rønn-Jensen
* start wiki pages
*/
public class Start {
public static void main(String[] args) {
Server jettyServer = null;
try {
jettyServer = new Server();
SocketConnector conn = new SocketConnector();
conn.setPort(8080);
jettyServer.setConnectors(new Connector[]{conn});
WebAppContext context = new WebAppContext();
context.setContextPath("/");
context.setWar("src/main/webapp");
jettyServer.setHandler(context);
jettyServer.start();
} catch (Exception ignore) {
if (jettyServer != null) {
try {
jettyServer.stop();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}
}