Access static resources reported 404 errors

First look at whether your interceptor to intercept a static resource, there is no problem if no interceptions,

Blocker Solution: https://www.cnblogs.com/mophy/p/8465598.html

Then there may be a path to your static resources is a problem, when the introduction of static resources, whether ../ use this method, if it is then it will report 404, can not find the resources.

 

Solution

Adding jsp page head tag

    <% pageContext.setAttribute("APP_PATH",request.getContextPath()); %>

Path through the project to import static resource use

href="${APP_PATH }/static/assets/css/demo.css"

$ {APP_PATH} represents: / project name, may be positioned directly webapp directory.

 

Guess you like

Origin www.cnblogs.com/hzh-666/p/11311744.html