我想从p:selectOneMenu中选择区域设置,然后重新发送根据新区域设置呈现的网页字幕。我的解决方案没有调用bean valueChangeListener处理程序(测试日志没有出现在System.out上)。 我在页面上显示了此错误消息: "转换错误设置值' hu' for' null Converter'"
小脸:
...
<p:selectOneMenu id="localeID" value="#{localeBean.selectedLocale}" valueChangeListener="#{localeBean.onLocaleChanged(event_)}">
<f:selectItems value="#{localeBean.locales}"/>
<p:ajax update="@all"/>
</p:selectOneMenu>
...
托管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" ) );
}
有人可以告诉我原因并给我一个解决方案吗?