使用struts2拦截器报错,请高手解决

[复制链接]
查看11 | 回复4 | 2010-6-18 23:25:53 | 显示全部楼层 |阅读模式
我用struts2 实现的SSH整合,我在Action用的是表对应的类对象UserTable,我不用拦截器,能正确的执行,用了拦截器运行时,Action中UserTable就是null的了,请问是什么原因,我拦截器里面,就写了一句return ai.invoke();
Action中写的是
private UserManager userManagerImpl;
private UserTable userTable;
public String add(){
System.out.println(getUserTable().getName());
userManagerImpl.addUserManager(userTable);
return this.SUCCESS;
}
我运行时报错,为什么只在网页上报错,tomcat 怎么不报错,报的错误 是
java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity
org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:40)
org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:23)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:697)
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)
com.dao.impl.UserDaoImpl.add(UserDaoImpl.java:13)
com.service.impl.UserManagerImpl.addUserManager(UserManagerImpl.java:17)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)







/emp/list.action
/emp/add.jsp



如果我不想用默认的拦截器,该怎么处理,能写一点点配置的代码给我看一下吗

回复

使用道具 举报

千问 | 2010-6-18 23:25:53 | 显示全部楼层
你在action中使用了自定义的interceptor之后,默认的拦截器就不起作用了,你要把struts-default中的你要用到的拦截器复制action配置中才行
回复

使用道具 举报

千问 | 2010-6-18 23:25:53 | 显示全部楼层
要在action中加一个拦截器栈拦截器栈中要包括自定义的拦截器和默认的拦截器栈
回复

使用道具 举报

千问 | 2010-6-18 23:25:53 | 显示全部楼层
拦截器配置问题引起的
回复

使用道具 举报

千问 | 2010-6-18 23:25:53 | 显示全部楼层
是空对象引用的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行