Tuesday, November 29, 2011

If you want a servlet to take the same action for both GET and POST request, what should you do?

Simply have doGet call doPost, or vice versa.:u can call doGet Method in doPost method and vice versa i.e:The first answer above will create a deadlock, so to take the same action for both Get and Post requests, call one of the doGet() or doPost() methods from the other method, not both.:You can have doGet() and doPost() method and another method say handleRequest() called by both of them. and handleRequest can do the rest of the operations.:override service method of Servlet interface or Generic Servlet class
Category:Servlet Interview Questions

No comments:

Post a Comment