Java Reference
In-Depth Information
}
catch (Exception e)
{
// display stack trace in the browser
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
response.getOutputStream().print(stringWriter.toString());
}
}
}
The only difference between this servlet and the one in the previous section is that
we declare a HashMap and populate it with the report parameters. Notice how the
HashMap key must match the report parameter name.
After deploying the servlet and directing the browser to its URL, we should see a
report like the following:
 
Search WWH ::




Custom Search