<bean id="searchProduct" name="/SearchProduct_init" class="com.web.action.ZcTmAction" lazy-init="default" autowire="default" dependency-check="default">
<property name="zcDlService" ref="zcDlServiceImpl"/> 
</bean>其中 SearchProduct_init  为STRUCT SearchProduct_init.do
我的ZcTmAction要处理很多的SearchProduct_*.do当我改<bean id="searchProduct" name="/SearchProduct_*" ...> 时,zcDlService注入不了?????报错误了。zcDlService是接口zcDlServiceImpl是实现的bean 难道我要对ZcTmAction 做N个bean 

解决方案 »

  1.   

    个人不太赞成把action也配成bean的配置!
      

  2.   

    struts跟struct是一个东西么。。?
      

  3.   

    up 三楼
    还是然action管理action,不要spring管理action,让你的action继承ActionSupport,获取spring的上下文
      

  4.   

    ZcTmAction要处理很多的SearchProduct_*.do 
    -----------------------------------------
    通常一个action只配置一个指定的path吧,
    <action path="/ZcTmAction"
     type="org.springframework.web.struts.DelegatingActionProxy"
     scope="request"
     name="xxxForm"
     parameter="method">
     <forward name="hot" path="/WEB-INF/jsp/main/xxx.jsp"></forward>
    </action>在spring的context里
    <bean name="/ZcTmAction" class="com.web.action.ZcTmAction" scope="prototype"
         autowire="byName"/>这样就可以了啊,ZcTmAction要处理很多的SearchProduct_*.do 
    只需要 /ZcTmAction.do?method=init
          /ZcTmAction.do?method=add......