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 does tomcat servlet container work?
What is string tokenizer?
Explain the difference between servletconfig and servletcontext in servlet?
What is the workflow of a servlet?
What is the life-cycle of servlets?
What is servlet container?
What are the new features added to servlet 2.5?
Whether we can get deadlock situation in servlets?
What is http servlet?
What are the different methods involved in generic servlet?
What is the use of welcome-file-list?
What is a web application and what is it’s directory structure?
How to handle exceptions thrown by application with another servlet?
Is that servlet is pure java object or not?
Can filter be used as request or response?