1. 程式人生 > >springmvc設定預設首頁

springmvc設定預設首頁

 

<welcome-file-list>

<welcome-file>index</welcome-file>

</welcome-file-list>

 

 

<servlet-mapping>

<servlet-name>dispatcher</servlet-name>

<url-pattern>/index</url-pattern>

</servlet-mapping>

 

 

寫在以下配置的後面

<servlet>

<servlet-name>dispatcher</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>

<!--配置dispatcher.xml作為mvc的配置檔案-->

<param-name>contextConfigLocation</param-name>

<param-value>classpath:/spring/dispatcher-servlet.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>dispatcher</servlet-name>

<url-pattern>/</url-pattern>

</servlet-mapping>