protected boolean preTemplateProcess(HttpServletRequest request, HttpServletResponse response, Template template, TemplateModel templateModel) throws ServletException, IOException {
boolean result = super.preTemplateProcess(request, response, template, templateModel);
SimpleHash hash = (SimpleHash) templateModel;
HTMLPage htmlPage = (HTMLPage) request.getAttribute(RequestConstants.PAGE);
String title, body, head;
if (htmlPage == null) {
title = "No Title";
body = "No Body";
head = "<!-- No head -->";
} else {
title = htmlPage.getTitle();
StringWriter buffer = new StringWriter();
htmlPage.writeBody(buffer);
body = buffer.toString();
buffer = new StringWriter();
htmlPage.writeHead(buffer);
head = buffer.toString();
hash.put("page", htmlPage);
}