How to debug a servlet?
Answers were Sorted based on User's Feedback
Answer / 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 |
What is the use of java servlet api?
Explain how does JSP handle run-time exceptions?
What is dispatcher servlet?
What is called servlet mapping?
we cant Override Jsp Service method?Why?
4 Answers Infrasoft, Mind Tree,
What’s the difference between genericservlet and httpservlet?
What is the web server used for running the Servlets?
What are the life cycle methods of the servlet?
What do you mean by chaining in servlet?
can i call destroy() method in init() method of servlet
How we can call a jsp from the servlet?
What is the purpose of requestdispatcher interface?