public class LocaleViewHandler extends ViewHandler{
private final ViewHandler base;
public LocaleViewHandler(ViewHandler base){
super();
this.base = base;
}
@Override
public Locale calculateLocale(FacesContext context) {
Locale locale;
HttpSession session = (HttpSession) context.getExternalContext()
.getSession(false);
if (session != null) {
//Return the locale saved by the managed bean earlier
locale = (Locale) session.getAttribute("locale");
if (locale == null) {
locale= new Locale("en");
}
return locale;
}
return base.calculateLocale(context);
}
@Override
public String calculateRenderKitId(FacesContext arg0) {
// TODO Auto-generated method stub
return base.calculateRenderKitId(arg0);
}
@Override
public UIViewRoot createView(FacesContext arg0, String arg1) {
// TODO Auto-generated method stub
return base.createView(arg0, arg1);
}
@Override
public String getActionURL(FacesContext arg0, String arg1) {
// TODO Auto-generated method stub
return base.getActionURL(arg0, arg1);
}
@Override
public String getResourceURL(FacesContext arg0, String arg1) {
// TODO Auto-generated method stub
return base.getResourceURL(arg0, arg1);
}
@Override
public void renderView(FacesContext arg0, UIViewRoot arg1)
throws IOException, FacesException {
// TODO Auto-generated method stub
base.renderView(arg0, arg1);
}
@Override
public UIViewRoot restoreView(FacesContext arg0, String arg1) {
// TODO Auto-generated method stub
return base.restoreView(arg0, arg1);
}
@Override
public void writeState(FacesContext arg0) throws IOException {
// TODO Auto-generated method stub
base.writeState(arg0);
}
public ViewHandler getBase() {
return base;
}
}
我正在尝试内部化示例,我编写了如上所示的视图处理程序。我有两种语言环境英语和法语。但是在编写了这个处理程序之后。控制台上没有错误,但它显示空白页。可以做些什么来查看视图..