The origin server did not find a current representation for the target resource or is not willing...

如下代码:

@RequestMapping("say")
public ModelAndView hello() {
    System.out.println("hello is run");
    ModelAndView modelAndView = new ModelAndView();
    modelAndView.setViewName("/WEB-INF/jsp/hello.jsp");
    modelAndView.addObject("msg", "hello springmvc...");
    return modelAndView;
}

跳转至hello.jsp页面,却报:


image.png

最终发现问题是由于ModelAndView导包错误,太马虎了,记录下!

import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.servlet.ModelAndView;(应该使用这个)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容