The new study Spring3.0,angularjs and Bootstrap, has been considering if the three together. Today, in the process of trying, encountered a stumbling block.No mapping found for HTTP request with URI [/springmvc/js/bootstrap.min.js]
The configuration of Web. XML is as follows
<servlet-mapping>
<servlet-name>Mumu</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Here, there are three ways to configure it.
<url-pattern>/</url-pattern>
Will match a path-type URL such as/login, which does not match a suffix url such as *.jsp, thus causing static resources such as js,css to be inaccessible to
<url-pattern>/*</url-pattern>
Matches all URLs: path-and suffix-type URLs (including/login,.jsp,.js and *.html, etc.)
When the URL matches,
<url-pattern>/</url-pattern>
does not match to *.jsp, does not enter spring's Dispatcherservlet class
<url-pattern>/*</url-pattern>
Will match *.jsp, resulting in spring's Dispatcherservlet class, and then to find the controller, and then can not find the corresponding controller so error.
<url-pattern>*. Do</url-pattern>
<url-pattern>*. html</url-pattern>Requests that match the end of all HTML
<url-pattern>*</url-pattern>Can't use*, or error
Workaround:
- The first method: Add in Web. xml
<servlet-mapping>
<servlet-name>Default</servlet-name>
<url-pattern>*. css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Default</servlet-name>
<url-pattern>*. gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Default</servlet-name>
<url-pattern>*. jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Default</servlet-name>
<url-pattern>*. js</url-pattern>
</servlet-mapping>
- The second method: Add the following in the servlet
<mvc: Default -servlet-handler />
Note: The required version is spring3.0.5 or higher.
- The third method: Add the following in the servlet
mapping="/resources/**"location="/resources/" />
This configuration tells spring how to handle static resources.
No mapping found for HTTP request with URI