Today, I set up the development environment of sprintMVC+MyBatis, but I can’t load the static resource file. After checking relevant materials, I found that my web-.xml configuration is as follows, so that the DispatcherServlet will intercept all requests (.js.css…). There is no corresponding processing method in the controller, so the required files cannot be loaded
<!-- Set Spring DispatchServlet -->
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Then change the configuration of the URl-pattern to *.do to intercept only requests from.do, and you can access the resource file
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Read More:
- Failed to import static file of vue3 static resource. There is no static folder
- Nuxt cannot find the static resource in static
- Spring MVC – enable static resource access
- node.js Static resource acquisition failed
- Error domain = nsurlerrordomain code = – 1001 “request timeout occurred in swift alamofire get request. ” UserInfo={NSUnderlyingErro
- An error is reported during Java operation due to the problem of static resource export
- [W xx:xx:xx.xxx NotebookApp] 404 GET/static/components/react/react-dom.production.min.js (::1)
- non-static variable this cannot be referenced from a static context
- Four ways to get Django parameters in request
- ajax error 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- GeTx reports an error in the get request using getconnect
- jsp: Failed to load resource: the server responded with a status of 400 (Bad Request)
- TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
- The problem that headers [‘content-type ‘] does not work is set in the Axios get method request interface
- docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
- Flask Request an extension before_request after_request errorhandler
- After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme
- (springmvc) Failed to load resource: the server responded with a status of 404 (Not Found)
- IIS “Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long.”
- Error: Rule can only have one resource source (provided resource and test + include + exclude)