下载 jetty包
在src下添加包 com.bak.server.web
添加 WEB-INF WEB-INF下面在添加 web.xml
com.bak.server.web添加 a.jsp
启动代码
Connector conn = new SelectChannelConnector();
conn.setPort(8080);
server.setConnectors(new Connector[] {
conn
});
ContextHandlerCollection contexts = new ContextHandlerCollection();
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("com/bak/server/web");
contexts.addHandler(webapp);
server.setHandler(contexts);
server.start();
server.join();
执行代码
ie中输入 http://localhost:8080/a.jsp