<bean id="loginAction" class="com.leadton.system.system.action.LoginAction" scope="prototype">
spring 默认scope 是单例模式
这样只会创建一个Action对象
每次访问都是同一个Action对象,数据不安全
struts2 是要求 每次次访问 都对应不同的Action
scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象
本文探讨了Struts2框架如何与Spring框架整合使用。重点介绍了通过设置scope属性为prototype来确保每次请求都能获得新的Action实例,从而避免数据安全问题。文章举例说明了在查询操作中,如果不使用prototype模式可能导致的数据残留问题。
<bean id="loginAction" class="com.leadton.system.system.action.LoginAction" scope="prototype">
spring 默认scope 是单例模式
这样只会创建一个Action对象
每次访问都是同一个Action对象,数据不安全
struts2 是要求 每次次访问 都对应不同的Action
scope="prototype" 可以保证 当有请求的时候 都创建一个Action对象

被折叠的 条评论
为什么被折叠?