spring mvc 配置 MultiActionController InternalPathMethodNameResolver spring mvcexceptionbean控制器 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 empMultiController这个bean里,没有叫commandClass 这个成员。楼主请把MultiActionController这个类贴一下 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)); }} 我觉得不需要在EmpMultiController中对Emp配置set get方法吧!!!! 不需要set get方法。但<property name="xxx"> xxx是你类里的成员变量的名字。根据你的代码commandClass 是EmpMultiController类的一个成员变量;但你的EmpMultiController代码里,是没有 叫commandClass 的变量的,因此,很可能是存在你的父类里面。那你的父类就是MultiActionController。所以,我想看看MultiActionController类,你可以down一下spring的源码,就能看到这个类的内容。个人怀疑是,可能是spring的版本不对。 那我该用什么版本呢?我用的是spring-framework-3.1.1.RELEASE这个版本的!!! http://blog.csdn.net/crazy1235/article/details/28440583这个类的源代码太长了,我放到上面那个连接里 了?我感觉不是版本的问题吧、?~~~~我也不确定! 我去扫了一下源码,你这样试试把配置文件里的那个commandClass 换成 command 我去扫了一下源码,你这样试试把配置文件里的那个commandClass 换成 commandsorry,我刚才自己去down了一下代码,你需要把这<property name="commandClass">整行去掉,就没问题了。 我刚才试了一下,发现打开表单页面可以,但是提交的时候提交不过去!麻烦解释一下,为什么不需要<property name="commandClass">这个呢? 求1个正则表达式 Struts2跳转问题 用JavaMail做的邮件 添加附件问题 谁有Hibernate3的包发给我一个,我这里的网下不了,谢谢了 万达宝 笔试题目 急啊 晚上笔试了,在线等候。。。。。。。。。。。。。。。。。 LOG4J 提出警告 该如何解决? 高手来看看 问一个weblogic 的初浅奇怪问题 llegalStateException 错误 java里面是否有保留几位小数的方法? 为什么这段java代码不能实现数值交换? 竟然遇到这么个奇葩问题,求帮忙 俄罗斯方块的移动问题!!!
楼主请把MultiActionController这个类贴一下
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));
}
}
但<property name="xxx"> xxx是你类里的成员变量的名字。
根据你的代码commandClass 是EmpMultiController类的一个成员变量;
但你的EmpMultiController代码里,是没有 叫commandClass 的变量的,因此,很可能是存在你的父类里面。
那你的父类就是MultiActionController。
所以,我想看看MultiActionController类,你可以down一下spring的源码,就能看到这个类的内容。个人怀疑是,可能是spring的版本不对。
我用的是spring-framework-3.1.1.RELEASE这个版本的!!!
、?~~~~我也不确定!
把配置文件里的那个commandClass 换成 command
把配置文件里的那个commandClass 换成 command
sorry,我刚才自己去down了一下代码,你需要把这<property name="commandClass">整行去掉,就没问题了。
麻烦解释一下,为什么不需要<property name="commandClass">这个呢?