Importing css files into jsp does not work

Importing css files into jsp does not work

The problem the author encountered was that after the css file was introduced into the jsp page, the style could not be loaded, which was resolved by introducing the following code into the SpringMVC configuration file dispatcherServlet.xml:

<mvc:default-servlet-handler></mvc:default-servlet-handler>

<mvc:default-servlet-hander>The role of the label: When the web container starts, a DefaultServletHttpRequestHandler will be defined in the context, which will process the request of the DispatcherServlet. If the request has been mapped, it will then be handed over to the corresponding handler in the background. If there is no mapping , it will be handed over to the default Servlet of the web application server to find the corresponding static resource, and an error will be reported only when the resource cannot be found.

Note: There are various reasons for the ineffective introduction of css files into jsp, and many of them are due to path problems. The author here only provides a solution to the problem, records the learning process, and avoids failure next time pit.

Guess you like

Origin blog.csdn.net/qq_54162207/article/details/125872631