Spring MVC configuration welcome page

Configure the servlet in web.xml

 

<!-- servlet control jump-->  
<servlet>  
    <servlet-name>spring</servlet-name>  
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
    <!-- config file -->  
    <init-param>  
        <param-name>contextConfigLocation</param-name>  
        <param-value>classpath:context-dispatcher.xml</param-value>  
    </init-param>  
</servlet>  
<servlet-mapping>  
    <servlet-name>spring</servlet-name>  
    <url-pattern>*.html</url-pattern>  
</servlet-mapping>  
<servlet-mapping>  
    <servlet-name>spring</servlet-name>  
    <url-pattern>/index</url-pattern><!-- 必须 -->  
</servlet-mapping>  
<servlet-mapping>  
    <servlet-name>spring</servlet-name>  
    <url-pattern>/background/index</url-pattern><!-- If the background folder is background and you want to access it directly through the domain name + background, you must -->  
</servlet-mapping>  
<welcome-file-list>  
    <welcome-file>index</welcome-file><!-- 必须 -->  
</welcome-file-list>

 

And create a new empty index file in the root directory of the web file (don't forget this step!)

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326902461&siteId=291194637