Sean Giles wrote:

> How can I set the locale for each individual user session before the first
> page displays?
>
> I've tried putting the session.setAtttribute(Action.Locale_key,<locale>) but
> it always displays in the default locale of the machine?  Changing the
> machine locale causes the correct properties file to be used so I know that
> is not the problem.
>

In the Struts example app, this is done by including the following tag on the
index.jsp page (actually, on every page):

    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html locale="true">
    ... page content ...
    </html:html>

This causes that <html:html> tag to consult the "Accept-Language" header sent by
the browser, and set up a Locale in the user's session if it is not already
there -- exactly the same way that the controller servlet does this if you
configure it to.

NOTE:  There are currently problems with this on servlet containers that do not
correctly implement the JSP 1.1 requirements for converting custom tag attribute
values.  I have heard problem reports about JRun 3.0 and ATG in this regard.

>
> Thanks
> Sean Giles

Craig


Reply via email to