JSF

This page (revision-8) was last changed on 19-Sep-2018 13:22 by Dieter Käppel

This page was created on 22-Oct-2010 13:36 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
8 19-Sep-2018 13:22 8 KB Dieter Käppel to previous
7 19-Sep-2018 13:22 8 KB Dieter Käppel to previous | to last
6 19-Sep-2018 13:21 8 KB Dieter Käppel to previous | to last
5 09-Jan-2014 11:03 8 KB Dieter Käppel to previous | to last
4 04-Nov-2010 15:47 6 KB Dieter Käppel to previous | to last
3 03-Nov-2010 14:20 4 KB Dieter Käppel to previous | to last
2 29-Oct-2010 17:16 2 KB Dieter Käppel to previous | to last
1 22-Oct-2010 13:36 2 KB Dieter Käppel to last

Page References

Incoming links Outgoing links
JSF

Version management

Difference between version and

At line 107 added 54 lines
!ViewHandler
{{{
package com.intersult.jsf;
import java.io.IOException;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import com.sun.facelets.FaceletViewHandler;
import com.sun.facelets.tag.jsf.ComponentSupport;
public class PartialViewHandler extends FaceletViewHandler {
public PartialViewHandler(ViewHandler parent) {
super(parent);
}
@Override
public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException {
String region = context.getExternalContext().getRequestParameterMap().get("region");
if (region == null) {
super.renderView(context, viewToRender);
} else {
renderRegion(context, viewToRender, region);
}
}
private void renderRegion(FacesContext context, UIViewRoot viewToRender, String region) {
try {
this.buildView(context, viewToRender);
UIComponent component = viewToRender.findComponent(region);
ResponseWriter writer = super.createResponseWriter(context);
FacesContext.getCurrentInstance().setResponseWriter(writer);
ComponentSupport.encodeRecursive(context, component);
writer.close();
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
@Override
public void writeState(FacesContext context) throws IOException {
String region = context.getExternalContext().getRequestParameterMap().get("region");
if (region == null)
super.writeState(context);
}
}
}}}