web.xml 配置Spring 與 struts

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SMS</display-name>
  
  <!--指定Spring 的配置文件 默認從web根目錄尋找配置文件,我們可以通過spring提供的classpath:前綴指定從類路徑下尋找-->
  <context-param>
  	<param-name>contextConfigLocation</param-name>
  	<param-value>classpath:beans.xml</param-value>
  </context-param>
  <!-- 對Spring 容器進行實例化-->
  <listener>
  	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  	</listener>
  	
  	<!--配置Struts2-->
  	<filter>
  		<filter-name>Struts2</filter-name>
  		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  	</filter>
  	
  	<filter-mapping>
  		<filter-name>Struts2</filter-name>
  		<url-pattern>/*</url-pattern>
  	</filter-mapping>
  	
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章