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 |
Explain the steps involved in placing a servlet within a package?
What is the difference between servlet config and servlet context.
19 Answers TCS, Tech Mahindra, Vertex,
Explain in brief the directory structure of a web application?
Explain the lifecycle of a servlet?
Can we override the ActionServlet?
3 Answers ArisGlobal, HCL, PPF,
What are its drawbacks of cgi?
Explain load on start-up and its importance?
What is webservlet?
Why is servlet used?
Can a servlet be called by passing its name as a parameter in the URL?
Describe in brief RequestDespatcher?
i have 500 jsp in my application ,with same forward name,it lokks for appropritae jsp from 1 to 500,but i want to send response to 498 page,what should i do