ITPub博客

首页 > 应用开发 > Java > Embeded Jetty with JSP

Embeded Jetty with JSP

原创 Java 作者:21ca 时间:2017-03-21 13:39:18 0 删除 编辑
Simple Jetty server with JSP supported.
  1.     public static void main(String[] args) throws Exception {
  2.         Server server = new Server(8082);

  3.         Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
  4.         classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
  5.                 "org.eclipse.jetty.annotations.AnnotationConfiguration" );

  6.         WebAppContext context = new WebAppContext("src/main/webapp", "/");
  7.         server.setHandler(context);
  8.         server.start();
  9.     }
pom.xml
  1.       <dependency>
  2.           <groupId>org.eclipse.jetty</groupId>
  3.           <artifactId>apache-jsp</artifactId>
  4.           <version>9.4.2.v20170220</version>
  5.       </dependency>
  6.       <dependency>
  7.           <groupId>org.eclipse.jetty</groupId>
  8.           <artifactId>jetty-annotations</artifactId>
  9.           <version>9.4.2.v20170220</version>
  10.       </dependency>


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10742815/viewspace-2135750/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Redis sentinel
请登录后发表评论 登录
全部评论

注册时间:2009-03-24

  • 博文量
    58
  • 访问量
    83504