Spring mvc Spring MVC-请求的资源不可用
我打字的时候Spring mvc Spring MVC-请求的资源不可用,spring-mvc,configuration,model,Spring Mvc,Configuration,Model,我打字的时候 http://localhost:1111/Quizat/test 在URL中,我没有加载login.jsp,但在控制台上打印了“testisrunning”消息 我的控制器: @RequestMapping("/test") public ModelAndView test(Model model) throws Exception { System.out.println("test is running");
http://localhost:1111/Quizat/test
在URL中,我没有加载login.jsp,但在控制台上打印了“testisrunning”消息
我的控制器:
@RequestMapping("/test")
public ModelAndView test(Model model) throws Exception {
System.out.println("test is running");
return new ModelAndView("login");
}
My dispatcher servlet.xml
org.springframework.web.servlet.view.JstlView
/看法/
.jsp
我正在做一个“动态网络项目”。我的login.jsp位于“WebContent/view/”中。请帮助我解决此问题。为/login定义get映射 您得到的是“测试正在运行”,因为您的代码是
@RequestMapping(“/test”)
添加以下代码-
<property name="prefix"><value>/WEB-INF/views/</value></property>
/WEB-INF/views/
您在浏览器中找到什么了吗?从问题的标题看,你看起来是,但是你能发布堆栈吗?我只收到一个404错误,消息是“请求的资源不可用”,我已经在我提供的代码段中找到了/view/My view文件夹位于WebContent内,而不是WEB-INF内。因此,我将路径指定为/view/。我不明白。请你把片段给我好吗。谢谢
<property name="prefix"><value>/WEB-INF/views/</value></property>