"; then add the configuration ""."/> "; then add the configuration "".">

Home  >  Article  >  Web Front-end  >  What should I do if springmvc does not load css?

What should I do if springmvc does not load css?

藏色散人
藏色散人Original
2020-12-22 09:44:172445browse

The solution to springmvc not loading css: first add the default configuration to the SpringMVC configuration as "7ea4b1506262239595c16a77e7a712b1"; then add the configuration "

What should I do if springmvc does not load css?

The operating environment of this tutorial: Windows7 system, css3&&Spring5.x version, this method is suitable for all brands of computers .

Recommended: "css Video Tutorial"

SpringMVC cannot load js, css and other static resource files, and an exception cannot be found when running. How to solve this?

Since SpringMVC supports more elegant Rest-style URLs, and url-patten is configured to support all patterns, static resources (css, js, html, etc.) will also be matched. Once the matching fails The console will throw a URI matching exception.

In this case, you need to add the default configuration in the SpringMVC configuration

<mvc:default-servlet-handler/>

After adding the above configuration, the original RequestMapping will be abnormal again. At this time, you need to add the following configuration

<mvc:annotation-driven></mvc:annotation-driven>

Note that this configuration generally needs to be added during the development process of SpirngMVC.

The above is the detailed content of What should I do if springmvc does not load css?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn