PDA

View Full Version : Tiles & MessageResources don't work


cagan327
Apr 21st, 2006, 11:59 AM
I am writing a new web app using Spring MVC (2-m2). In the front-end I am using tiles as the templating engine.
The integration is fine. I can get to see pages composed properly.
But <fmt:message key="somekey"/> does not work. It brings bak ???somekey???
I am certain that my resource bundle setup is correct as all works fine when I use a JstlView implementation rather than TilesView.

As the locale resolver, I'm using org.springframework.web.servlet.i18n.FixedLocaleRe solver defined as follows in my spring-servlet.xml:

<bean id="locale" class="java.util.Locale">
<constructor-arg><value>tr</value></constructor-arg>
<constructor-arg><value>TR</value></constructor-arg>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.FixedLocaleRe solver">
<property name="defaultLocale"><ref bean="locale"/></property>
</bean>

My resource bundle is called messages.properties (and I also have the messages_tr_TR.properties in place) and these files are under /WEB-INF/classes.


I would appreciate any help on this.

Thanks,
Cagan

laenzlinger
Apr 21st, 2006, 05:21 PM
Maybe you have to use TilesJstView instead of TilesView

http://www.springframework.org/docs/api/org/springframework/web/servlet/view/tiles/TilesJstlView.html

That should expose the locale and the resource bundle to jstl

cagan327
Apr 21st, 2006, 06:51 PM
Maybe you have to use TilesJstView instead of TilesView

http://www.springframework.org/docs/api/org/springframework/web/servlet/view/tiles/TilesJstlView.html

That should expose the locale and the resource bundle to jstl

Yes. That fixed the problem. Thanks a lot.
Cagan