title: Java, Spring hooking themes properties file to css file
body: <p>this is how I intialize theme beans:</p>
  
  <pre><code>&lt;bean id="themeSource"
  class="org.springframework.ui.context.support.ResourceBundleThemeSource"&gt;
      &lt;property name="basenamePrefix" value="resources.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;bean id="handlerMapping"
      class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt;
      &lt;property name="interceptors"&gt;
          &lt;list&gt;
              &lt;ref bean="localeChangeInterceptor" /&gt;
              &lt;ref bean="themeChangeInterceptor" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>this is my folder stucture:</p>
  
  <p><img src="https://i.stack.imgur.com/3DC2q.png" alt="enter image description here"></p>
  
  <p>these are the inside of my 3 properties files:</p>
  
  <pre><code>css=themes/black.css
  css=themes/blue.css
  css=themes/default.css
  </code></pre>
  
  <p>I have also tried these:</p>
  
  <ol>
  <li>css=classpath:themes/default.css</li>
  <li>css=/themes/default.css</li>
  <li>css=./themes/default.css</li>
  </ol>
  
  <p>Should the css even be in WEB-INF/classes. I've tried moving it out and in etc, but never quite seemed to get it to work.</p>
  
  <p>Here is how I put it in my JSP:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="&lt;spring:theme code='css'/&gt;" type="text/css" /&gt;
  </code></pre>
  
  <p>This is now my output looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/WN90L.png" alt="enter image description here"></p>
  
  <p>This is part of JSP:</p>
  
  <pre><code>&lt;span style="float: left"&gt;
  &lt;a href="?theme=default"&gt;def&lt;/a&gt;
  |
  &lt;a href="?theme=black"&gt;blk&lt;/a&gt;
  |
  &lt;a href="?theme=blue"&gt;blu&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>This is my black.css.</p>
  
  <pre><code>body {
      background-color: #888;
      color: white;
  }
  </code></pre>
  
  <p><strong>My problem is, that the css never seems to go on my JSP file. This is probably caused because properties file can not find css file...</strong>
  Feel free to ask further info.</p>