*
The moose likes JSF and the fly likes [JSF 2] internationalization:  UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "[JSF 2] internationalization:  UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped" Watch "[JSF 2] internationalization:  UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped" New topic
Author

[JSF 2] internationalization: UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped

Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

Hi,
I have this <h:selectOneMenu> tag where the user can change the language.


Here is the method of the managed bean :




The method is called but the values of the current view are not updated. They are updated if i refresh the page.
Here are the sequence of phases calls :
1) User changes the language :


2) User refreshes the page :


Obviously, the UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped.

Question : why are they skipped and how can i call them ?
Well I did manage to call these 2 phases with these 2 lines :
event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
event.queue();
In that case all phases are called. Still, I need to refresh the page to get the chosen language.

Thanks in advance for helping.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Ed Burns
author
Ranch Hand

Joined: Sep 11, 2006
Posts: 82
    
    5
I think a better way to do it would be to use the "locale" property of
<f:view>, like this:

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

Then have the getter do whatever you need to do to look it up.

Would that work?

Ed

P.S. On 2 February, here on JavaRanch, I'm doing an event to promote my
new book, JavaServer Faces 2.0: the Complete Reference. Stay tuned for
details!

Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

Well,
I already have that property set on the view. And the getter/setter on the bean.

I did as you suggested though and modified the locale in the getter :



I can see that it goes through all the phases but I still need to refresh the page to get the new values (different language).

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: [JSF 2] internationalization: UPDATE_MODEL_VALUES et INVOKE_APPLICATION phases are skipped
 
Similar Threads
Capturing initial view instance in restore view phase
Issues with facelets and saveState?
Render Response phase is not getting invoked
Jumping past phases 2, 3, 4, and 5?
Issue using h:commandLink with rendered attribute