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
How do you define a servlet?
What are Servlets?
When jsessionid is created?
Why don't we write a constructor in a servlet?
What are important features of Servlet 3?
What is MIME Type?
What are the differences between forward() method and sendredirect() methods?
What are all the ways for session tracking?
What is a cookie What is the difference between session and cookie
Explain the difference between a web server and a web container?
What is called a session?
What is the major difference between servlet and applet?
What are the different methods involved in the process of session management in servlets?
What if we pass negative value in load-on-startup?
Tell the new features added in servletrequest interface i.e. Servlet 2.4