protected void renderError(String msg, Exception e, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
Debug.logError(msg + ": " + e, module);
try {
Writer writer = new StringWriter();
ScreenRenderer screens = new ScreenRenderer(writer, null, new HtmlScreenRenderer());
screens.populateContextForRequest(request, response, servletContext);
screens.getContext().put("errorMessage", msg + ": " + e);
screens.render(DEFAULT_ERROR_TEMPLATE);
response.setContentType("text/html");
response.getWriter().write(writer.toString());