Answer Posted / madhusudhakar
res.setContentType("text/html");
ServletOutputStream out = res.getOutputStream();
try {
// do your thing here
...
}
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
out.println("
");
out.print(sw.toString());
out.println("
");
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is servletconfig?
Which method is called when reference variable is passed in system.net?
Explain web application directory arrangement?
What is the difference between sendredirect() and forward() in a servlet?
How can an existing session be invalidated?
What is preinitialization of a servlet?
How to rectify errors in java servlet while compilation?
How servlet is created?
How httpservlet is different from the genericservlet?
How the typical servlet code look like ?
What is the servlet?
What is java servlet session?
What is the major difference between context parameter and context attribute?
Name the different ways of session tracking.
Why doesn’t a servlet include main()? How does it work?