Struts2+hibernate+spring 配置文件中scope="prototype"的作用
来源:互联网 发布:翰文网络计划注册码 编辑:程序博客网 时间:2024/04/28 19:35
下面是struts2+hibernate+spring配置文件的一部分,以前都是仿造已经写好的bean的配置。有一次 scope="prototype"忘记写了结果出了问题
项目中对一个表的增删该操作是用一个action,这个action有add,update,delete,save这些方法,添加和修改是共用一个页面,当页面得到id时代表进行的修改操作,反之是添加操作。因为在配置spring的bean是忘了写scope="prototype"所以每次添加时都显示最后一次访问过的记录
找了很长时间,原来是spring bean出了问题。 scope="prototype" 会在该类型的对象被请求时创建一个新的action对象。如果没有配置scope=prototype则添加的时候不会新建一个action,他任然会保留上次访问的过记录的信息。
<bean id="assetAction" class="com.servicezone.itsd.asset.webapp.action.AssetAction" scope="prototype">
<property name="assetManager" ref="assetManager"/>
<property name="itProductManager" ref="itProductManager"/>
<property name="vendorManager" ref="vendorManager"/>
<property name="deptManager" ref="deptManager"/>
<property name="userManager" ref="userManager"/>
<property name="assetTypeManager" ref="assetTypeManager"/>
</bean>
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用 .
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用 .
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- struts2.0中spring配置文件中action的属性 scope="prototype"
- struts2.0中spring配置文件中action的属性 scope="prototype" .
- struts2.0中spring配置文件中action的属性 scope="prototype"
- Spring中scope="prototype"属性的作用
- sping+struts2中配置Action的bean中scope="prototype"的作用
- sping+struts2中配置Action的bean中scope="prototype"的作用
- spring配置文件中 scope="prototype" 学习笔记
- Spring 注解 @Scope("prototype") 的作用
- spring开发:spring的作用域(scope="prototype";scope="singleton")
- spring的scope="prototype"
- Linux 共享内存
- SVN1.4.6 + apache2.2.11 + tomcat 6.0.18 集成 配置
- 如何通过ftp对比多个机器的文件差别
- I changed to the service---github instead
- 类构造器包含一个本类参数的代码使用
- Struts2+hibernate+spring 配置文件中scope="prototype"的作用
- struts模式匹配
- struts配置中的路径与模式匹配
- 关于多维数组的“不形象”理解
- 域名分类详细介绍
- 游客进场
- 选择ARM处理器,ARM7还是Cortex-M3
- 假期过去了
- utf-8,gbk,gb2312的区别