ModevAndView#addObject在何处添加对象?

时间:2018-07-24 18:16:15

标签: spring-mvc httprequest modelandview

我有一个像这样的控制器

@RequestMapping("/welcome")
    @ResponseBody
    public ModelAndView welcome() {
        ModelAndView modelAndView = new ModelAndView("welcome");
        modelAndView.addObject("name", "john");

        return modelAndView;
    }

当我通过Postman应用向/welcome发出请求时,可以在任何地方获取“ welcome.jsp as response. However, I cannot see the object name”页面的HTML。我怎么看?

modelAndView.addObject("name", "john");时会发生什么?

0 个答案:

没有答案