开发者

How to set the current locale in JSF using Javascript?

Hi I want to change the locale using javascript in the JS开发者_如何学GoF.Can anyone give example.


Just let JavaScript send a HTTP request in some way (form.submit(), window.location, ajax, etc) so that JSF is able to do

String locale = getItAsRequestParameterOrSomething(); // "en", "en_US", etc
FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale(locale));

You can find a kickoff example which does that by a dropdown which is submitted by JS in this answer: Localization in JSF, how to remember selected locale per session instead of per request/view

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜