You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jatinder Singh <Ja...@Copart.Com> on 2005/10/20 19:59:52 UTC

Change Locale

Hi,

I'm trying to change the locale for the current user like this:

JSP:
<h:commandLink immediate="true" action="#{Home.germanLocal}">
	<h:graphicImage value="/german_flag.gif"/>
</h:commandLink>


PageBean:

public void germanLocal()
{
	FacesContext.getCurrentInstance().getViewRoot().setLocale(Locale.GERMAN);
}

It changes the local for the current page but when I navigate to another page it is changed back to the default.

Am I missing something here?

Thanks
Jatinder

Re: Change Locale

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

you need to specifiy the locale to a bean in f:view tag and change the
value there also.

Jatinder Singh wrote:
> Hi,
> 
> I'm trying to change the locale for the current user like this:
> 
> JSP:
> <h:commandLink immediate="true" action="#{Home.germanLocal}">
> 	<h:graphicImage value="/german_flag.gif"/>
> </h:commandLink>
> 
> 
> PageBean:
> 
> public void germanLocal()
> {
> 	FacesContext.getCurrentInstance().getViewRoot().setLocale(Locale.GERMAN);
> }
> 
> It changes the local for the current page but when I navigate to another page it is changed back to the default.
> 
> Am I missing something here?
> 
> Thanks
> Jatinder
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Action Simulation

Posted by Patrick Dalla Bernardina <pa...@jfes.trf2.gov.br>.
How can I simulate an event (a click in a button or link) from java code?