jsp页面中的哪个对象与控制器中的Model对应?

时间:2016-02-11 01:00:31

标签: java spring jsp spring-mvc

我正在使用jsp作为前端页面调试Spring MVC web-app。它的控制器将数据填充到Model:

    @RequestMapping(method = RequestMethod.GET)
public String setUpForm(HttpServletRequest req, @ModelAttribute UserCommand userCommand,
        BindingResult result, ModelMap model) {
    HttpSession session = req.getSession();

    userCommand = (UserCommand)session.getAttribute("USER_COMMAND");

    /*
        populate data into fields of userCommand object
        ....
    */

    model.addAttribute("userCommand", userCommand);
    return "nextPage";
}

在jsp中,我知道有一些隐含的对象:request,session,pageContext,... 如果我想查看请求对象的内容,我可以在jsp中设置断点并检查其内容。

问题是:Model对象对应哪个jsp对象?我担心的是我想要检查在scriptlet(<%...%>)中从控制器传递到jsp页面的模型对象的内容。

(我使用scriptlet,因为它允许我设置断点。我知道有表达式语言,如$ {},但不能使用断点和检查。)

0 个答案:

没有答案