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 are the security issues in Servlets?
can we override service method in my servlet class..?? if yes or no why ??
Is Servlet Class Thread safe?????? How to make servlet Thread safe ???
what is the difference between Servlet and JSP?Advantage of JSP over Servelt?Any concept present in JSP which we cant implement in Servlet?
31 Answers ABC, Apere, AZTEC, CTS, CybAge, iFlex, Impact Systems, Sara, TCS,
List out the difference between ServletConfig and ServletContext?
Why do we need servlet filter?
How servlet is created?
Explain request dispatcher and its methods.
What is servlet looping or chaining?
what is the difference b/w DispatchAction and LookUpDispatchAction?
1 Answers Deloitte, iGate, Tech Mahindra,
What is meant by Servlet? What are the parameters of service method?
What are the benefits of using servlet over cgi?