as I asked time ago in this question, I solved my problem using this method:
In 开发者_StackOverflowloging.xhtm, for instance:
<f:view locale="#{languageDetails.locale}" > <head> ..... <f:loadBundle basename="messages.Messages" var="msg1"/> .....
</h:form>
</body> </f:view>
2.In java source code I also made some changes:
public class LanguageDetails {
private static String locale = Locale.getDefault().getDisplayLanguage();
public void setLocale(String locale1) {
this.locale = locale1;
}
public synchronized String getLocale() {
return locale;
}
public synchronized String changeLanguage() {
return "changed";
}
}
But now I'm trying to have the same option, not just in Login page, but in other pages.
Adding the same code in other pages, doesn't work, because functionsetLocale
is not called. Any help?
Thanks in advanceI realized, it's really important to put
<f:view locale="#{languageDetails.locale}" >
....
</f:view>
Or in every single file, or just in top file. Later, put <h:selectOneMenu>
where necessary, but having always in mind that you can not have all <h:form>
, <a4j:form>
... etc. you want, it makes things more complicated. I put this form tags just on top files, and now everything is ok.
Hope this could help somebody.
精彩评论