Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

JSF Immediate attribute  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Report post to moderator
Here i got a problem pertaining to h:selectOneListbox, i have a page with a drop down list showing available languages, when the user change to other selection, the page will automatically change is content base on the selected langauge (Locale).

Below shows the source code
....// jsp
<h:selectOneListbox id="select" value="#{localeTracker.defaultLocale}" valueChangeListener="#{localeTracker.changeLocale}" onchange="this.form.submit()" immediate="true" >
<f:selectItems value="#{localeTracker.langItems}" />
</h:selectOneListbox>

...// LocaleTracker class
public void setChoosenLocale( String choosenLocale )
{
this.choosenLocale = choosenLocale ;
}

public String getChoosenLocale()
{
return this.choosenLocale ;
}

public void changeLocale( ValueChangeEvent vc )
{
FacesContext con = FacesContext.getCurrentInstance();
con.getViewRoot()
.setLocale( new Locale( this.getChoosenLocale() ) );
}
..

For example. there are English and Spannish as current available langauge
and English is currently being selected, When i select Spannish, The locale is using English, and if i select english, the spannish is being used, meaning that the value set to the choosenLocale is the value being deselected ( the old value )

Could any help me out pls. Thank you
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • Report post to moderator
I suggest you register and post your question in the JSF forum.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Report post to moderator
Agreed. I'm closing this thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!