struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Struts Newsgroup ( <>
Subject Re: multiple languages.
Date Mon, 27 May 2002 11:40:01 GMT
Subject: Re: multiple languages.
From: "Emmanuel Cornette" <>
found in the javadoc for the package org.apache.struts.util (package
summary) :

Using MessageResources With Struts
If your application uses the Struts controller servlet, you can optionally
configure Struts to load an application-specific message resources instance
for you, and make it available as a servlet context attribute (in JSP terms,
an application-scope bean). This mechanism is managed by setting the
following servlet initialization parameters in the web application
deployment descriptor:

  a.. application - The configuration string that will be passed to the
createResources() method of the message resources factory, in order to
identify the family of resources to be supported. If you use the standard
message resources factory, this must be the base fully qualified name of the
property resources files used to contain these messages, as illustrated
  b.. factory - Fully qualified Java class name of the
MessageResourcesFactory to be used. By default, the standard implementation
provided by Struts (org.apache.struts.util.PropertyMessageResourcesFactory)
will be used.
Struts provides several JSP custom tags that assume the existence of a
java.util.Locale attribute in the user's session, under the key named by the
constant string value of Action.LOCALE_KEY. Your own application logic can
set this attribute at any time, or you can ask Struts to set it
automatically (if not already set) based on the Accept-Language HTTP header
included with the request. There are two mechanisms by which you request
Struts to perform this service:

  a.. To have this service performed on every request submitted to the
controller servlet, set the servlet initialization parameter locale to the
value true in the application deployment descriptor.
  b.. To have this service performed by a JSP page when it is accessed
directly by a user, utilize a <form:html ... locale="true" ... /> tag at the
top of each page.
I hope it helps.


<> wrote in message
> I want the user to select one language during login.
> How do I set this Language in struts?
> So that struts doesn't automatically detect the defaultlanguage
> of the browser. It should take the one I set.
> thanks in advance.
> --------------------------------------------------------------------------
> ----------------
> Hanel Matthias
> Fachinformatiker (Anwendungsentwicklung) in Ausbildung
> Logistik World GmbH Fon: +49-841-9014-300
> Marie-Curie-Strasse 6 Fax: +49-841-9014-302
> D- 85055 Ingolstadt
> --------------------------------------------------------------------------
> ----------------
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message