Spring @ModelAttribute和BindingResult行为

Spring @ModelAttribute和BindingResult行为,spring,Spring,我创建了两个类A和B。类A有一个计算方法 @RequestMapping(method = RequestMethod.POST) public String calculate( HttpServletRequest request, PlanVO planVO, BindingResult result, Map<String, Object> model) throws Par

我创建了两个类A和B。类A有一个计算方法

@RequestMapping(method = RequestMethod.POST)
    public String calculate(
            HttpServletRequest request,
           PlanVO planVO,
            BindingResult result,
            Map<String, Object> model) throws ParserConfigurationException, 
                        SAXException, IOException {
validator.validate(planVO, result);
        if (result.hasErrors()) {           
            model.put(PLAN_VO, planVO);
            return "test";
        }
现在我想问为什么A类不需要这个@ModelAttribute,或者为什么B类需要这个


提前感谢。

请分享B类代码,以确定PLAN\u VO常量在哪里?它是全局的还是每个控制器的?是的,我只是在方法签名中添加@modeldattribute,它开始工作了…没有变化。。。
@RequestMapping(method = RequestMethod.POST)
        public String calculate(
                HttpServletRequest request,
                PlanVO planVO,
                BindingResult result,
                Map<String, Object> model) throws ParserConfigurationException, 
                            SAXException, IOException {
    validator.validate(planVO, result);
            if (result.hasErrors()) {           
                model.put(PLAN_VO, planVO);
                return "test";
            }
@RequestMapping(method = RequestMethod.POST)
            public String calculate(
                    HttpServletRequest request,
                    @ModelAttribute("planVO") PlanVO planVO,
                    BindingResult result,
                    Map<String, Object> model) throws ParserConfigurationException, 
                                SAXException, IOException {
        validator.validate(planVO, result);
                if (result.hasErrors()) {           
                    model.put(PLAN_VO, planVO);
                    return "test";
                }