PDA

View Full Version : Problem with using themes in sitemesh decorator


chelya
Apr 28th, 2006, 11:01 PM
themes work fine when used in jsp views. However when I attempt to do the same thing in sitemesh decorator (loaded before request gets to the DispatcherServlet) it fails to lacate theme property file and resolve the value.

I have theme beans defined in app-servlet.xml

<bean id="themeSource" class="org.springframework.ui.context.support.ResourceBun dleThemeSource">
<property name="basenamePrefix">
<value>foo.bar.</value>
</property>
</bean>
<bean id="themeResolver" class="org.springframework.web.servlet.theme.FixedThemeRe solver">
<property name="defaultThemeName">
<value>mytheme</value>
</property>
</bean>


Logs tell an interesting story:

<load all applicationContext-*.xml>
...
INFO org.springframework.ui.context.support.UiApplicati onContextUtils.initThemeSource(83) - Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBun dleThemeSource@1202d69]
...
<load app-servlet.xml>
...
INFO org.springframework.ui.context.support.UiApplicati onContextUtils.initThemeSource(67) - Using ThemeSource [org.springframework.ui.context.support.ResourceBun dleThemeSource@e31e33]
INFO org.springframework.web.servlet.DispatcherServlet. initThemeResolver(435) - Using ThemeResolver [org.springframework.web.servlet.theme.FixedThemeRe solver@11abd68]


Somehow themeSource is attempted to be initialized twice, but themeResolver is only initialized once.
Thoughts?

chelya
May 1st, 2006, 12:45 PM
Any thoughts at all? I am thinking it may be a bug in 2.0 m4.

yamini04
Sep 19th, 2006, 10:03 PM
Hi ,
I saw u msg..saying themes working fone with jsps..
I am trying to do it..but not reading the values from style.css
I am send the code here..please have a lok and tell me the necessary changes..

servlet.xml i gave this code

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundle MessageSource">
<property name="basenames">
<list>
<value>resourcemessage</value>
<value>cool</value>
<value>theme</value>
</list>
</property>
</bean>


i have created 2 property files theme.properties, dev properties with keys
styleSheet=/themes/cool/style.css
background=/themes/cool/img/Peace.jpg

I have the folder structure themes/cool

in jsp i added this line
<link rel="stylesheet" href="<spring:theme code="styleSheet"/>" type="text/css" />


style.css contains this
body,table {
font-family: Garamond, "Arial", serif;
background: red; color: green;
}

h1,h2 { font-family: Garamond, "Arial", serif; }

but i try to change these values in style.css it is not updating in my page.

please give me the solution
thanks