JSTL c:url 不工作

JSTL c:url not working

我正在学习 Spring MVC。我的静态资源已使用 spring taglib 成功映射。但是如果我使用 JSTL c taglib.

资源不会被映射

项目结构

web.xml

spring-servlet.xml

main.css

h1{
    color:red;
}

welcome.jsp

输出

Jquery 和 main.js 加载了 spring 标签库,这就是为什么 h2 有 body,但我不明白为什么 h1 的颜色不是红色?

05-May-2017 15:45:24.843 WARNING [http-nio-8080-exec-4] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/basic/public-resources/css/main.css] in DispatcherServlet with name 'dispatcher'

我找到了解决方案。我改变了

<link rel="stylesheet" href='<c:url value="/public-resources/css/main.css" />'>

<link rel="stylesheet" href='<c:url value="/resources/css/main.css" />'>

IntelliJ 提示目录未解析且整个目录为红色的错误。但在部署时,它会起作用。