解决方案 »

  1.   

    empMultiController这个bean里,没有叫commandClass 这个成员。
    楼主请把MultiActionController这个类贴一下
      

  2.   


    MultiActionController是spring的类,我继承了它public class EmpMultiController extends MultiActionController { // 转到add页面
    public ModelAndView toAdd(HttpServletRequest request,
    HttpServletResponse response) {
    ModelAndView mav = new ModelAndView();
    mav.setViewName("addEmp");
    mav.addObject("depList", new String[] { "a", "b", "c" });
    return mav;
    } // 提交表单,如果需要session对象,则必须放到command对象(Emp)之前
    public ModelAndView toAddEmp(HttpServletRequest request,
    HttpServletResponse response, HttpSession session, Emp emp) {
    System.out.println(emp);
    session.setAttribute("emp", emp);
    return new ModelAndView("userInfo");
    } @Override
    protected void initBinder(HttpServletRequest request,
    ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(Date.class, new CustomDateEditor(
    new SimpleDateFormat("yyyy-MM-dd"), true));
    }
    }
      

  3.   

    我觉得不需要在EmpMultiController中对Emp配置set  get方法吧!!!!
      

  4.   

    不需要set get方法。
    但<property name="xxx"> xxx是你类里的成员变量的名字。
    根据你的代码commandClass 是EmpMultiController类的一个成员变量;
    但你的EmpMultiController代码里,是没有 叫commandClass 的变量的,因此,很可能是存在你的父类里面。
    那你的父类就是MultiActionController。
    所以,我想看看MultiActionController类,你可以down一下spring的源码,就能看到这个类的内容。个人怀疑是,可能是spring的版本不对。
      

  5.   

    那我该用什么版本呢?
    我用的是spring-framework-3.1.1.RELEASE这个版本的!!!
      

  6.   

    http://blog.csdn.net/crazy1235/article/details/28440583这个类的源代码太长了,我放到上面那个连接里 了?我感觉不是版本的问题吧
    、?~~~~我也不确定!
      

  7.   

    我去扫了一下源码,你这样试试
    把配置文件里的那个commandClass 换成 command
      

  8.   

    我去扫了一下源码,你这样试试
    把配置文件里的那个commandClass 换成 command
    sorry,我刚才自己去down了一下代码,你需要把这<property name="commandClass">整行去掉,就没问题了。
      

  9.   

    我刚才试了一下,发现打开表单页面可以,但是提交的时候提交不过去!
    麻烦解释一下,为什么不需要<property name="commandClass">这个呢?