Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Register plugin in "Tiles plugin configuration"

Matthias Stoll

2006-12-18

Replies:

Thx Antonio

extending and overriding nop, but how to register in "Tiles plugin
configuration". Do you mean chain-config.xml? How to do that?

TXH

Matthias Stoll ha scritto:
> Hi there.
>
> I have a Tiles / Struts application. When using i18n in Struts (property

> files) everything works fine, even if the user has selected a language
in
> his browser (e.g. en as preferred language, struts loads the property_en

> file). Tiles is not doing so. It loads the default definition file
> (without _en or _de) at initialization. Struts controller Locale is set
to
> true. Tiles only changes locale when manually setting
> request.getSession().setAttribute (Globals.LOCALE_KEY, Locale.ENGLISH).
> Does anyone have an idea, what the problem is?
>

Uh you're right! I18NFactorySet takes the locale only from the session!
Anyway you can:
* use Tiles 2 (that is currently in the sandbox
http://struts.apache.org/struts-sandbox/tiles/index.html ) that does not
suffer from this problem
* or create your own FactorySet, extending I18NFactorySet and overriding
the getDefinitionsFactoryKey, taking the locale from the request.
Obviously you have to register it in the Tiles plugin configuration.

HTH
Antonio
©2008 junlu.com - Jax Systems, LLC, U.S.A.