jetty 文件服务器 jsp,Spring MVC在部署到嵌入式Jetty 8服务器时无法找到JSP

我试图运行嵌入式Jetty服务器并将Spring MVC应用程序部署到其中,但存在资源映射问题 - 特别是我无法映射spring mvc控制器以便它可以找到我的JSP。Spring MVC在部署到嵌入式Jetty 8服务器时无法找到JSP

配置:

码头,8.1.8.v20121106

春3.2

Jetty服务器配置:

Server server = new Server();

ServletContextHandler context = new ServletContextHandler();

//WebAppContext context = new WebAppContext();

context.setBaseResource(Resource.newClassPathResource("webapp"));

context.setClassLoader(Thread.currentThread().getContextClassLoader());

context.setContextPath("/");

AnnotationConfigWebApplicationContext webAppContext = new AnnotationConfigWebApplicationContext();

webAppContext.register(WebFaceSpringConfiguration.class);

webAppContext.setServletContext(context.getServletContext());

webAppContext.setParent(applicationContext);

context.addServlet(new ServletHolder(new DispatcherServlet(webAppContext)), "/");

server.setHandler(context);

server.setConnectors(jettyConnectors);

文件夹webapp在classpath中,但在这样的配置中,我有一个错误访问/WEB-INF/pages/main-page.jsp时出现问题(它实际上位于webapp下)。因此调用控制器方法,但视图无法解析。

我试图使用WebAppContext和Spring Dispatcher Servlet(/ *)的通配符映射,但它没有帮助 - 控制器映射被忽略或JSP无法找到。

2013-04-26

viator

+0

你可以发布你的错误? –

2013-04-26 13:25:02

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值