美文网首页
The origin server did not find a

The origin server did not find a

作者: hongzhenw | 来源:发表于2019-10-11 16:05 被阅读0次

    如下代码:

    @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;(应该使用这个)
    

    相关文章

      网友评论

          本文标题:The origin server did not find a

          本文链接:https://www.haomeiwen.com/subject/ymxxmctx.html