title: Spring MVC Themes Not working
body: <p>I am trying to execute a Spring MVC application that uses Spring MVC theme feature. I am following this example <a href="https://www.youtube.com/watch?v=OiQql85qsos" rel="nofollow noreferrer">https://www.youtube.com/watch?v=OiQql85qsos</a> But somehow its not working, here is the project structure in STS</p>
  
  <p><img src="https://i.stack.imgur.com/lHtxQ.jpg" alt="enter image description here"></p>
  
  <p>I just have a  HomeController</p>
  
  <pre><code>@Controller
  public class HomeController {
  
  @RequestMapping("/")
  public String getHomePage(){
      return "home";
  }
  
  }
  </code></pre>
  
  <p>Here is the web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID" version="3.0"&gt;
  &lt;display-name&gt;SpringMVCThemes&lt;/display-name&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;config&lt;/servlet-name&gt;
      &lt;servlet-   class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;config&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Below is the config-servlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"&gt;
  
  &lt;mvc:annotation-driven&gt;&lt;/mvc:annotation-driven&gt;
  &lt;context:component-scan base-package="co.edureka.controllers"/&gt;  
  
  &lt;mvc:resources mapping="/resources/**" location="/resources/*" /&gt;
  &lt;mvc:resources mapping="/images/**" location="/resources/images/" /&gt;
  &lt;mvc:resources mapping="/css/**" location="/resources/css/" /&gt;  
  
  &lt;bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/views/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt; 
  
  &lt;bean id="themeSource"
      class="org.springframework.ui.context.support.ResourceBundleThemeSource"&gt;
          &lt;property name="basenamePrefix" value="META-INF.theme-" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="themeChangeInterceptor"
      class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"&gt;
      &lt;property name="paramName" value="theme" /&gt;
  &lt;/bean&gt; 
  &lt;bean id="themeResolver"
      class="org.springframework.web.servlet.theme.CookieThemeResolver"&gt;
      &lt;property name="defaultThemeName" value="default" /&gt;
  &lt;/bean&gt;
  
  &lt;mvc:interceptors&gt;
  &lt;ref bean="themeChangeInterceptor"/&gt;
  &lt;/mvc:interceptors&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Here is the content of theme-black.properties (under WebContent/META-INF)</p>
  
  <pre><code>css=resources/css/theme-black.css
  </code></pre>
  
  <p>Below is the content of theme-black.css (under WebContent/resources/css)</p>
  
  <pre><code>body {
  background-color: #DBF5FF;
  color: #007AAB;
  }
  </code></pre>
  
  <p>Here is the home.jsp but on clicking on other themes link it does not change the themes</p>
  
  <p><img src="https://i.stack.imgur.com/04XRA.jpg" alt="home.jsp">    </p>
  
  <p>I checked the cookies , there is a cookie with name org.springframework.web.servlet.theme.CookieThemeResolver.THEME</p>
  
  <p>How to make it work ?</p>