【发布时间】:2016-11-11 05:55:55
【问题描述】:
我有一个 Spring MVC,将 Embedded Jetty 从 Jetty 7 升级到 Jetty 9.3.9 和 Java 8。我重写了 Embedded Jetty 9 类以支持 Jetty 9 的 JSP 参考示例 here 和一些关于 SO 的有用问题,但是当我启动应用服务器时,我仍然得到 p>
Problem accessing /webapp/WEB-INF/views/404.jsp
每当我尝试访问 http://localhost:8080/webapp/index 时,我都会收到 404 Not found,但是,从我可以看到的信息日志中,webapp 正在访问 My BaseController:
@Controller
public class BaseController{
private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
@RequestMapping(value = "/index", method = RequestMethod.GET)
public ModelAndView login(HttpServletRequest request,
HttpServletResponse response) {
String sessionid = request.getSession().getId();
Map<String, String> model = new HashMap<String, Object>();
logger.info("Requested home page...");
model.put("Welcome Page", "Welcome to home");
return new ModelAndView("index", model);
}
我的项目层次结构,我有两个项目。 Jetty-Startup 启动 Jetty 服务器来配置服务器属性。其他项目 - 我所有的 web.xml、servlet、控制器、JSP、JS、CSS 等都驻留的 webapp。
是否有一些我缺少 JSP 支持的配置?任何人都可以弄清楚我缺少什么,这将非常有帮助。
提前致谢!
【问题讨论】:
-
在访问 webapp >> src >> main >> webapp >> WEB-INF >> 视图目录中的 JSP 页面时,我得到了“404”。我的服务器在不同的项目中 - jetty-startup 。另外,在启动码头时,我看到了
/webapp:main: No Spring WebApplicationInitializer types detected on classpath。不知道是不是配置错误。
标签: java jsp spring-mvc embedded-jetty jetty-9