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 advantages do servlets have over CGI programs?
Explain the difference between get and post method in servlet?
How can I share objects across different sessions?
How to rectify errors in java servlet while compilation?
servlet life cycle?
What is the importance of init() method in Servlet ?
Explain the concept of ssi ?
Tell us something about servletcontext interface.
How to get the path of servlet in the server?
how the HTML data stored in web server?
What do you mean by web applications? Explain web application directory arrangement?
Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file?