I am confused about how you are supposed to go about changing the Locale. I am doing this:
<f:view locale="#{person.locale}">
<f:loadBundle basename="messages" var="msgs"/>
<h:form>
<h:commandButton value="#{msgs.switchLanguage}"
actionListener="#{person.swapLocale}"
immediate="true"/>
</h:form>
</f:view>
The swapLocale method swaps the Locale to/from English and Spanish, and my Person bean is session-scoped. The problem is that when I press the button, I don't get the new Locale until I manually reload the page. I put a trace in the swapLocale and getLocale methods, and I find that when I press the button, the getLocale method is called, then the swapLocale method is called, and the getLocale method is [b]not [/b]called again after the call to swapLocale. I get the same behavior with action instead of actionListener, and also if I remove immediate="true".
Clearly, I am misunderstanding the lifecycle here. Why isn't getLocale being called [i]after [/i]the actionListener method [swapLocale]? What is the proper way to let the user set the Locale?
Thanks!
- Marty
-----
JSF 2.0 Training Course:
http://courses.coreservlets.com/public-courses/jsf2/
[Message sent by forum member 'martyhall']
http://forums.java.net/jive/thread.jspa?messageID=471955