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’s the difference between genericservlet and httpservlet?
How can you use a servlet to generate a plain text instead of html?
What do you mean by scope object and what are its types?
Is it possible to have a constructor inside the servlet?
What is the use of send redirect () method?
Is java servlet still used?
What are setSecure() and getSecure() methods in Cookies?
What do you mean by url pattern in servlet?
What are the key methods that are involved in processing of http servlets?
How can we include static files in the jsp page?
What is war file?
Explain Action Servlet?