Spring / Spring MVC Interview questions
How to enable browser caching of static resources (JS, CSS) with Spring MVC?
Using mvc:resources tag we can specify the cache period.
<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" cache-period="31556926"/>
Also mvc:interceptor can be used to specify the cache settings.
<mvc:interceptor> <mvc:mapping path="/WEB-INF/resources/*"/> <bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor"> <property name="cacheSeconds" value="31556926"/> <property name="useExpiresHeader" value="true"/> <property name="useCacheControlHeader" value="true"/> <property name="useCacheControlNoStore" value="true"/> </bean> </mvc:interceptor>
More Related questions...