// If an exception should be thrown the user gets a clear error message
ByteArrayOutputStream stream = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(stream, false, SIMPLE_TAG_ENCODING);
PageRequest request = new SimplePageRequest(req);
PageResponse response = new SimplePageResponse(this, req, resp, printStream, SIMPLE_TAG_ENCODING);
// Add the error to the page attributes
if (error != null) {
request.setContextAttribute("page.exception", error);
}