How to debug a servlet?

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


Please Help Members By Posting Answers For Below Questions

If some new data has entered the database, explain how can a servlet refresh automatically?

745


What are the functions of the servlet container?

1045


What is http servlet in java?

570


How can we implement a jsp page?

636


Can we refresh servlet in client and server side automatically?

600






How do I use cookies to store session state on the client?

540


How do you deal property files in servlet?

610


What exactly are the functions of servlet?

607


Write a command to get actual path of a servlet to the server?

544


Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com

1751


What's the difference between authentication and authorization?

556


How to find whether a parameter exists in the request object?

673


Why is httpservlet declared abstract?

590


What are the types of an http request?

591


Why servlet is faster than jsp?

572