使用Struts2 验证框架,使用拦截器验证权限的时候actionerror多次展示不消失多次添加问题。
原因:
struts2的action不是单例模式,每提交一次就会生成一个对象(多例action)
解决方法:
我用的是spring管理action,在处理action的bean中加入scope="prototype"就可以了例如:
<bean id="userAction" class="com.action.UserAction" scope="prototype">
<bean id="userAction" class="com.action.UserAction" scope="prototype">