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 do you mean by the servlet chaining?
Hi Frieds, I am new to servlet why to use servlet in webapplication. what i know is " use servlet as a controller in mvc and to implemnent business logic . is it correct ? One more thing reason for implementing business logic with servlets , why not jsp.
Can you explain in detail 'javax.servlet' package?
when you comppile the servlet is it neccesary to restaet the tomcat server?
What are the phases of servlet life cycle?
What is difference between cookies and httpsession?
Which event is fired at the time of setting, getting or removing attribute from application scope?
What is pure servlet?
How do you get the ip address of the client in servlet?
What are different types of Servlets?
How can we refresh automatically when new data has entered the database?
What are the steps that are involved in using the httpservlet class?