struts中Action是非線程安全的!
struts的action是非線程安全的。
不要在action中定義實例變量。
在spring的配置文件中,可以配置action為線程安全,即每次調用都生成一個新的實例,而不是只用一個實例。
bean中設置singleton="true"
<bean id="/itemDayAction" class="com.joyinter.skype.statistic.action.ItemDayAction" singleton="true">
<property name="itemDayBO">
<ref bean="itemDayBO"/>
</property>
<property name="avatarItemBO">
<ref bean="avatarItemBO"/>
</property>
</bean>
<property name="itemDayBO">
<ref bean="itemDayBO"/>
</property>
<property name="avatarItemBO">
<ref bean="avatarItemBO"/>
</property>
</bean>
posted on 2007-08-15 15:24 當扎瓦 閱讀(1960) 評論(1) 編輯 收藏 所屬分類: Spring 、Struts