I'd like to choose the locale from a p:selectOneMenu and resend the page captions rendered according to the new locale. My solution doesn't call the bean valueChangeListener handler (The test log does not appear on the System.out). I have got this error message rendered on the page: "Conversion Error setting value 'hu' for 'null Converter'"
The facelet:
...
<p:selectOneMenu id="localeID" value="#{localeBean.selectedLocale}" valueChangeListener="#{localeBean.onLocaleChanged(event_)}">
<f:selectItems value="#{localeBean.locales}"/>
<p:ajax update="@all"/>
</p:selectOneMenu>
...
The managed bean:
@ManagedBean
@SessionScoped
@Getter
@Setter
public class LocaleBean
{
private Map<String,Locale> locales;
private Locale selectedLocale;
public void onLocaleChanged( ValueChangeEvent event_ )
{
System.out.println( "LocaleBean.onLocaleChanged called" );
...
}
@PostConstruct
protected void initLocales()
{
selectedLocale = facesContextBean.getLocale();
locales = createLocalesMap();
locales.put( "English", new Locale( "en" ) );
locales.put( "Magyar", new Locale( "hu" ) );
}
Could anybody inform me about the reason and give me a solution?