1运行war
public static void main(String[] args) throws Exception {
Server server = new Server(8888);
WebAppContext context = new WebAppContext();
context.setContextPath("/ssmbase");
context.setWar("C:/Users/Administrator/Desktop/ssmbase3.war");
server.setHandler(context);
server.start();
server.join();
}
2.运行context
package com.google.code.garbagecan.jettystudy.sample6;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class WebAppContextWithFolderServer {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
WebAppContext context = new WebAppContext();
context.setContextPath("/myapp");
context.setDescriptor("E:/share/test/struts2-blank/WEB-INF/web.xml");
context.setResourceBase("E:/share/test/struts2-blank");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}
}