ScreenRenderer screens = new ScreenRenderer(writer, null, htmlScreenRenderer);
screens.populateContextForRequest(request, response, servletContext);
// this is the object used to render forms from their definitions
FreeMarkerWorker.getSiteParameters(request, screens.getContext());
screens.getContext().put("formStringRenderer", new HtmlFormRenderer(request, response));
screens.getContext().put("treeStringRenderer", new HtmlTreeRenderer());
screens.getContext().put("simpleEncoder", StringUtil.htmlEncoder);
htmlScreenRenderer.renderScreenBegin(writer, screens.getContext());
screens.render(page);
htmlScreenRenderer.renderScreenEnd(writer, screens.getContext());
writer.flush();