0

Will the code below is correct to map the contents of css/images/js folders in spring mvc properly. I moved around my folders but couldnt find proper places for it.

web.xml

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
</servlet-mapping>

I want my folders locate under WEB-INF so my spring-servlet.xml:

<mvc:resources location="/WEB-INF/" mapping="**"/>
3
  • possible duplicate of Spring MVC Static Resource Mapping Commented Aug 20, 2014 at 6:11
  • Thank, I couldnt search for that post. So do I need to configure in web.xml? Commented Aug 20, 2014 at 6:22
  • No in your dispatcher-servlet.xml Commented Aug 20, 2014 at 6:46

1 Answer 1

0

Add this code in servlet-context.xml

 <resources mapping="/resources/**" location="/resources/" cache-period="31556926"/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.