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 are the important functions of filters?
What is the life-cycle of servlets?
Explain the difference between servletconfig and servletcontext in servlet?
What is the use of servletconfig interface?
A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?
Explain session tracking and its importance?
What do you mean by url pattern in servlet?
What is the difference in between the httpservlet and generic servlet?
Explain how to improve Servlet Performance?
Write a simple servlet program to print the contents of html.
Why is init() method is used in servlets?
How can we create deadlock situation in servlet?
How is an application exception handling is done using a servlet?
How to get the current httpsession object?
What do you mean by chaining in servlet?