【发布时间】:2018-03-21 08:10:00
【问题描述】:
以下是Spring boot Hibernate项目中的文件夹层次结构,
这是用户资源控制器中的一个方法
@GetMapping("/")
public ModelAndView home(HttpServletRequest request){
//request.setAttribute("mode", "MODE_HOME");
ModelAndView model = new ModelAndView("index");
model.addObject("msg", "hello world");
return model;
}
以下代码也添加到 application.properties 文件中以找到正确的 jsp 页面。
spring.mvc.view.prefix:WebApp/Web/
spring.mvc.view.suffix:.jsp
但这不起作用,并出现以下错误。
无论如何,我尝试了很多方法,通过修改“application.properties”文件中的路径,但找不到合适的解决方案。是否有任何步骤可以触发 jsp 视图?
【问题讨论】:
-
检查
index.jsp在 /WEbApp/Web 下。 -
index.jsp 文件存在于 /WEbApp/Web 文件夹中
-
根据您的配置,您的 jsp 文件必须在 '/WEbApp/Web' 下。但是在图像 index.jsp 文件中的 '/WebApp' 下
-
是的。那是另一个测试 index.jsp 文件,但 index.jsp 文件在 /WebApp/Web 中仍然可用。我更新了图片
标签: java spring hibernate jsp spring-boot