web.xml configuration template file

Directly attached complete code, of course, spring core needs to be configured by the controller dependencies mean advance

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!--spring核心控制器-->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<-! <The init-param> ->
<- - <param-name> the contextConfigLocation </ param-name>!>
<- <param-value> CLASSPATH:! Dispatcher-servlet.xml </ param -value> ->
<-! </ the init-param> ->
<-! servlet.xml the Dispatcher-only file to configure the following sentence in the WEB-INF, if it will be placed in the following resources that is above the line 4 line comment replacement code ->
<Load-ON-Startup>. 1 </ Load-ON-Startup>
</ the servlet>
<-Mapping the servlet>
<the servlet-name> Dispatcher </ the servlet-name >
<! - intercept all mapping, ie all paths back program controller ->
<url-pattern> / </ url-pattern>
</ Mapping-the servlet>

<! - the default access Home ->
<welcome-file-list>
<welcome-file>/WEB-INF/jsp/index.jsp</welcome-file>
</ File-List-available for purchase>
</ Web-App>

localized screenshot above code as follows:

 




Guess you like

Origin www.cnblogs.com/c2g5201314/p/11389758.html