You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Volker Weber <us...@weber-oldenburg.de> on 2005/12/01 11:29:49 UTC

Re: Problem with Changing the locale, &

Hi Thomas,

i don't know what the problem with datatable and verbatim is, may be
worth to investigate, but to enable users to change the locale
independent from the preferences settings in there browsers, you should
provide a bean with a locale property.

add the attribute locale to the f:view tag:

<f:view locale="#{bean.locale}">

and change the beans locale value in your action method.

Regards

  Volker

YinYang wrote:
> Hi all,
> 
> I'm a newbie and have the following problem: We have in all pages
> commandLinks to enable the users change the Locale. The backing-Bean-methods
> look like e.g.:
> 
> public String at() {
> 	FacesContext context = FacesContext.getCurrentInstance();
> 	context.getViewRoot().setLocale(new Locale("de", "DE"));
> 	return null;
> }
> 
> This works very well with several pages (e.g. the dynamic navbar), but the
> <t:dataTable> produces a "column-mismatch":
> 
> If the columns are e.g.:		Account, Type, State, Created, Expires,
> outcome after a locale-change:	Account, Type, Account, Type, State, Created
> 
> 
> It gets even worse if a <f:verbatim> tag is used, it causes the following
> Exception:
> 
> javax.servlet.ServletException:
> org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlCommandNavigationItem
> 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
> 	sapphir.sit.sitware.gui.web.SecurityFilter.doFilter(SecurityFilter.java:57)
> 
> root cause
> javax.faces.FacesException:
> org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlCommandNavigationItem
> 	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(Serv
> letExternalContextImpl.java:421)
> 	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHan
> dlerImpl.java:234)
> 	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
> 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
> 
> 
> 
> So what do I wrong, and how else can I do a page-independent locale change?
> 
> Many thanks in advance,
> Thomas
> 
> 
> 

-- 
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.