jetty 6.1 笔记
jetty 6.2 代码启动
必要jar包
lib --->>![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241315-386037366.png)
![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241315-386037366.png)
lib--->>jsp2.0--->> ![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241658-1053578649.png)
![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241658-1053578649.png)
最终形成目录 -->>![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241877-1419259358.png)
![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085241877-1419259358.png)
mark jetty 6.1 jsp2.1 目录结构
![](https://images2015.cnblogs.com/blog/722496/201703/722496-20170324085242190-722620243.png)
注:由于使用jsp2.1 代码启动时不能对el很好的兼容 不支持三元运算,导致一些表达式抛出elexception 选择了jsp2.0
代码启动很简单:
package com.signheart.imagerotate.server;
import org.junit.Test;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
public class ServerStart extends Server {
@Test
public void serverStrart() throws Exception {
long begin = System.currentTimeMillis();
Connector connector = new SelectChannelConnector();
connector.setPort(Integer.getInteger("jetty.port", 8888).intValue());
WebAppContext webapp = new WebAppContext("F:/EDev/OA/Code/webapps/OA", "/");
Server server = new Server();
server.setConnectors(new Connector[] { connector });
server.setHandler(webapp);
server.start();
server.join();
System.out.println("Jetty Server started, use " + (System.currentTimeMillis() - begin) + " ms");
}
public void setup() {
}
public void serverStop() throws Exception{
Server server = new Server(8888);
WebAppContext webContext = new WebAppContext("F:/EDev/OA/Code/webapps/OA","/");
server.setHandler(webContext);
server.stop();
}
}