struts1与spring集成时,需要引入一注入属性 如:
public class UserAction extends Action{
private UserDao userDao;
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
........
}
//getter  setter
}
Action不是线程安全的,不知spring是怎样保证线程安全的,是不是phototype  bean系统每次都创建实例?同一对象也每次都创建新对象吗?对spring内部不熟悉.
请哪位大侠能帮我指点一下,非常非常地感谢您! 

解决方案 »

  1.   

    在spring中设置一下就行了,action用spring帮你生成
      

  2.   

     <action-mappings >
          <action
          attribute="userForm"
          input="/form/user.jsp"
          name="userForm"
          path="/user"
          parameter="operate"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy" />
    type不用本类地址用srping的org.springframework.web.struts.DelegatingActionProxy
    <bean name="/user"  class="com.accp.web.action.UserAction">
    <property name="goodsbiz" ref="goodsbizimp"></property>
    <property name="userbiz" ref="userbizimp"></property>
    </bean>
    spring的name和action的一样这样就OK啦
      

  3.   

     <action-mappings >
          <action
          attribute="userForm"
          input="/form/user.jsp"
          name="userForm"
          path="/user"
          parameter="operate"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy" />
    type不用本类地址用srping的org.springframework.web.struts.DelegatingActionProxy
    <bean name="/user"  class="com.accp.web.action.UserAction">
    <property name="goodsbiz" ref="goodsbizimp"></property>
    <property name="userbiz" ref="userbizimp"></property>
    </bean>
    spring的name和action的一样这样就OK啦