<url-pattern>/</url-pattern> 拦截请求
一、springmvc 前端控制器
<!-- springmvc的前端控制器 --> <servlet> <servlet-name>fw-sso-web</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- contextConfigLocation不是必须的, 如果不配置contextConfigLocation, springmvc的配置文件默认在:WEB-INF/servlet的name+"-servlet.xml" --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/springmvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>fw-sso-web</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
二、如果 <url-pattern>/</url-pattern>
则需要在 springmvc 配置文件中配置 资源映射
<!-- 资源映射 --> <mvc:resources location="/css/" mapping="/css/**"></mvc:resources> <mvc:resources location="/js/" mapping="/js/**"></mvc:resources> <mvc:resources location="/images/" mapping="/images/**"></mvc:resources>
三、如果是 <url-pattern>*.do</url-pattern> 、<url-pattern>*.action</url-pattern> 、<url-pattern>*.html</url-pattern> 等等,则不需要配置 资源映射