I'm learning Spring MVC. My static resources are successfully mapped using spring
taglib. But resources are not mapped if i use JSTL c
taglib.
Project Structure
web.xml
spring-servlet.xml
main.css
h1{
color:red;
}
welcome.jsp
output
Jquery and main.js is loaded with the spring
taglib that's why h2 has body, but I don't understand why h1's color is not red?
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'
I found the solution. I changed
<link rel="stylesheet" href='<c:url value="/public-resources/css/main.css" />'>
to
<link rel="stylesheet" href='<c:url value="/resources/css/main.css" />'>
IntelliJ is giving me error that the directory is not resolved and the whole directory is red. but when deployed, it works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.