If a servlet needs to perform some action repeatedly every time a request is received, which method is most appropriate for placing such code?

  • doGet()
  • doPost()
  • init()
  • service()
The service() method is the most appropriate for placing code that needs to be executed repeatedly every time a request is received. This method is invoked for each incoming request and can handle various HTTP methods like GET, POST, etc.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *