Struts注册Spring Context的三种方式

(1)使用Struts插件

         在struts-config.xml中
       

   < plug-in  className ="org.springframework.web.struts.ContextLoaderPlugin" >
    
< set-property  property ="contextConfigLocation"
                  value
="applicationContext.xml" />
  
</ plug-in >

(2)在web.xml中使用Listener

 

< context-param >
  
< param-name > contextConfigLocation </ param-name >
        
< param-value >
    /WEB-INF/classes/applicationContextxml,
        
</ param-value >
</ context-param >
< listener >
          
< listener-class > org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >      

 (2)在web.xml中使用Servlet

<servlet-name>springInitServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>0</load-on-startup>



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