FacesContext ctx = FacesContext.getCurrentInstance();
PartialResponseWriter writer = ctx.getPartialViewContext().getPartialResponseWriter();

writer.startDocument();

writer.startError(errorName);
writer.write(errorMessage);
writer.endError();

writer.endDocument();

ctx.renderResponse();
ctx.responseComplete();