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 |
give the syntax of doGet() and doPost()?
can i call init() method in destroy() method of servlset. ?
What are the types of servlet?
Can you use javascript in servlets?
How do you design microservices?
what are the different services provided by the web server?
If servlet receives multiple requests, how many objects will it create?
Can we use threads in Servlets?
Why are http servlets used in programming?
What is servlet api used for conneting database?
Why don't we write a constructor in a servlet?
how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file