This what I did:

++++++++++++++ In the homepage page:
<%
pageContext.setAttribute("URLPath", request.getRequestURL());
%>

<html:link  page="/setLocale.do?lg=en" paramId="url" paramName="URLPath">
            <bean:message key="headermenu.jsp.english"/> </html:link>

<html:link  page="/setLocale.do?lg=fr" paramId="url" paramName="URLPath">
            <bean:message key="headermenu.jsp.french"/> </html:link>

++++++++++++++ or

<a href="<c:url value="/setLocale.do?lg=ar" >
<c:param name="url" value="${pageContext.request.requestURL}"/>
</c:url>">
<bean:message key="headermenu.jsp.arabic"/>
</a>


++++++++++++++ In Struts Config:

<action name="setLocale" type="util.SetLocaleAction" validate="false" scope="request" 
path="/setLocale" />




++++++++++++++ In the SetLocaleAction:

    String language = httpServletRequest.getParameter("lg");
    String urlInput = httpServletRequest.getParameter("url");
    Locale locale = (Locale) httpServletRequest.getSession().getAttribute(org.
        apache.struts.Globals.LOCALE_KEY);

    httpServletRequest.getSession(true).setAttribute(
        org.apache.struts.Globals.LOCALE_KEY, new Locale(language));

    Locale newlocale = (Locale) httpServletRequest.getSession().getAttribute(org.
        apache.struts.Globals.LOCALE_KEY);

    int index = urlInput.indexOf(httpServletRequest.getContextPath()) +
        httpServletRequest.getContextPath().length();

    return (new ActionForward( urlInput.substring(index), true));



 -----Original Message-----
> From: James [mailto:[EMAIL PROTECTED]
> Sent: 05 March 2003 20:28
> To: [EMAIL PROTECTED]
> Subject: Re: Localisation
> 
> i'm not sure at the moment our current ' work around' is to only display
> the
> flags on the 'home' page which can be accessed via the menu. This way no
> data entry is lost..
> 
> but i would prefer a way of doing it from any page and returning to the
> same
> page, preferably with no data entry loss (or validation)..
> 
> 
> 
> 
> "Konstantina Stamopoulou" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> >
> > > You could set a group of forwards up, based on the locale ie
> > >
> > > <forward name="this_en" path="/jsp_pages/out_en-jsp" redirect="true"/>
> > > <forward name="this_de" path="/jsp_pages/out_de-jsp" redirect="true"/>
> > > <forward name="this_ko" path="/jsp_pages/out_ko-jsp" redirect="true"/>
> > >within <action/>
> >
> >
> > Does this mean  that someone has to implement a different .jsp for each
> > language? I need to implement something similar and I'm not sure that I
> > understand the answer. Don't you use the <bean:message> to display text
> in
> > different languages? I'm I missing something here?
> > James what is exactly the solution you are going to follow?
> >
> > > Cheers
> > >
> > > Simon
> >
> > Thank you in advance
> > Konstantina
> >
> >
> > > ----- Original Message -----
> > > From: "James" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, March 05, 2003 8:11 PM
> > > Subject: Localisation
> > >
> > >
> > > > I have a LocaleActionClass that sets the locale according to which
> wee
> > > flag
> > > > the user clicks, my question is how in the struts-config.xml do i
> > specify
> > > it
> > > > to forward to the page they changed locale on (i.e their original
> page).
> > > >
> > > > James
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------------------
> -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to