I am new to Spring mvc. I want to add css and js files in jsp. It\'s a spring mvc framework. This is my spring-dispatcher-servlet.xml code
Well it looks like your resource mapping is not correct, your css and js files are under "/resources" folder right? then the mapping should be
<mvc:resources mapping="/resources/**" location="/resources/"/>
The inclusion of the elements in the view have been answered multiple times in stackoverflow itself. You can refer unable to use resources like css/js in spring mvc or How to include js and CSS in JSP with spring MVC
In case you are still looking:
Resource Mapping:
<mvc:resources location="/resources/" mapping="/resources/**"/>
Adding JS/CSS in jsp pages:
<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/main.css"/>">
<script src="<c:url value="/resources/js/app.min.js"/>"></script>
Note: All of the JS/CSS files must be under src\main\webapp\resources
directory.
And if you have added Security, then you need to add this:
<http pattern="/resources/**" security="none"/>