Announcement Announcement Module
Collapse
No announcement yet.
Spring 3 - Themes are not working! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3 - Themes are not working!

    Hi,
    I have build an MVC spring project using STS, and I have integrated tiles within this project.
    Now I can't set any css template in my project. I'm not sure if I address the wrong url to my message.properties. please have a look:

    app-context.xml
    HTML Code:
    <bean id="messageSource"
    		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    		<property name="basename" value="classpath:messages" />
    		<property name="defaultEncoding" value="UTF-8" />
    	</bean>
    <bean id="themeSource"
    		class="org.springframework.ui.context.support.ResourceBundleThemeSource">
    		<property name="basenamePrefix" value="theme-" />
    	</bean>
    
    
    	<!-- Theme Change Interceptor and Resolver definition -->
    	<bean id="themeChangeInterceptor"
    		class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
    		<property name="paramName" value="theme" />
    	</bean>
    	<bean id="themeResolver"
    		class="org.springframework.web.servlet.theme.CookieThemeResolver">
    		<property name="defaultThemeName" value="default" />
    	</bean>
    
    	<bean id="handlerMapping"
    		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    		<property name="interceptors">
    			<list>
    				<ref bean="localeChangeInterceptor" />
    				<ref bean="themeChangeInterceptor" />
    			</list>
    		</property>
    	</bean>
    theme-blue.properties
    HTML Code:
    css=themes/blue.css
    I have also tried /themes/blue.css

    theme-black.properties
    HTML Code:
    css=themes/black.css
    layout.jsp
    HTML Code:
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <link rel="stylesheet" href="<spring:theme code='css'/>" type="text/css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><tiles:insertAttribute name="title" ignore="true" /></title>
    </head>
    <body>
    ....
    </body>
    </html>
    When I run the project, I can't see the css style. I also can't change the style from the user interface.
    any idea?
    Thanks.
    Please see the attached snapshot (shows the project structure).
    Attachment
    Attached Files

  • #2
    One thing more, the CSS themes re located in WEB-INF folder

    /WEB-INF/themes/blue.css

    if I address the path directly in my jsp file:
    HTML Code:
    <link rel="stylesheet" href="/WEB-INF/themes/blue.css" type="text/css" />
    nothing happens, and i'm not getting any warning.

    anyone ??

    Comment

    Working...
    X