[jboss-user] [JBoss Seam] - How to change locale from a Session Bean?

antispart do-not-reply at jboss.com
Tue Nov 7 10:44:05 EST 2006


Instead of using the SelectItems method as described in the examples I'd like to have images that represent each country (flags) that when clicked will change the locale.

This changes the locale but not the message bundle that is used. So, dates and times are formated properly but the message.properties is still used instead of messages_fr.properties when the locale is switched to French.

Any ideas what I'm doing wrong?

header.xhtml:

<h:form id="localeForm">             	       	    
  <s:link action="#{visitManager.changeLocale('en')}">
    <h:graphicImage url="/img/en.gif" />
  </s:link>
  &#160;
  <s:link action="#{visitManager.changeLocale('fr')}">
    <h:graphicImage url="/img/fr.gif" />
  </s:link>	       	    
</h:form>  


visitManagementBean.java:

public String changeLocale(String locale) {
  FacesContext.getCurrentInstance().getViewRoot().setLocale(new  Locale(locale));
	return null;
}  



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983801#3983801

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983801



More information about the jboss-user mailing list