Menu

Showing posts with label Overriding Get or Post method. Show all posts
Showing posts with label Overriding Get or Post method. Show all posts

Can we have multiple doGet() or doPost() in a servlet?

 No, it doesn't make sense to creating multiple doGet() or doPost() methods in a Servlet. The compiler will always execute the first one. It's better to write a different Servlet to handle the different requests.


One other way is the method overriding, we can override doGet() or doPost() in any of the methods viceversa. For more read Overriding Service, Get, and Post