1. 程式人生 > >SpringMVC配置不攔截靜態資源

SpringMVC配置不攔截靜態資源

使用SpringMVC框架的時候,有些檔案例如圖片,CSS等不需要攔截,我們可以使用這兩種方法:

1.  使用springmvc標籤配置靜態檔案的訪問,允許DispatcherServlet不攔截靜態資源



2. 在專案的web.xml中配置不攔截

Tomcat, Jetty, JBoss 自帶的預設Servlet的名字 -- "default"
WebLogic 自帶的 預設Servlet的名字  -- "FileServlet"
WebSphere  自帶的 預設Servlet的名字 -- "SimpleFileServlet"