ModelAndView 配置后,controller方法

在controller中,使用 ModelAndView 来返回页面,代码如下。
@RequestMapping(value = "/form/test" )
    public ModelAndView totest(HttpServletRequest request,HttpServletResponse response, TextLoginForm form) {
        String forwardString = "test";
        Map<String, Object> model = new HashMap<String, Object>();
        try {
        	form.setName("名字123123");
        	form.setPassword("密码");
            model.put("appli", form);
        } catch (Exception e) {
            forwardString = "msg";
        }
        return new ModelAndView(forwardString,model);
    }

上一篇:增加 ModelAndView 配置


下一篇:springMVC项目,测试controller 方法的 jsp