zoukankan      html  css  js  c++  java
  • spring的scope="prototype" java程序员

    项目中对一个表的增删该操作是用一个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>[/size][/size][/size][size=medium][/size]

  • 相关阅读:
    WebService帮助类改良版,支持多webservice
    .NET-list扩展方法Distinct去重
    C#创建泛型类T的实例的三种方法
    划水网站
    DataGridView增加右键取消操作
    Sql Server 快捷键
    SQL Server中使用convert进行日期转换
    ToolStrip 选中某一项打勾
    H5实现手写功能
    git使用
  • 原文地址:https://www.cnblogs.com/java20130725/p/3215764.html
Copyright © 2011-2022 走看看