[我]Struts+Spring的整合

xml 代码
  1. <action-mappings >  
  2.    <action  
  3.      attribute="indexForm"  
  4.      input="/index.jsp"  
  5.      name="indexForm"  
  6.      parameter="state"  
  7.      path="/index"  
  8.      scope="request"  
  9.     />  
  10.   
  11.   
  12.  action-mappings>  
  13.   
  14.  <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>  

 

这种通过加一个构造器,而不用在action里面都要写type="org.springframework.web.struts.DelegatingActionProxy"

而在另外一个文件中专门用来写/index 和action的对应如:

xml 代码
  1. <beans default-autowire="byName">  
  2.     <bean name="/index"  
  3.         class="org.langsin.computer.web.action.IndexAction"  
  4.         singleton="false">  
  5.         <property name="userService">  
  6.             <ref bean="userService" />  
  7.         property>  
  8.     bean>  
  9.   
  10. beans>  

这个文件名字可以叫action-servlet.xml

你可能感兴趣的:(spring,bean,Web,xml,struts)