• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet issue

 
lakshman kumaran
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one servlet class file which contains the service() ,doGet() and doPost() methods . I have posted the Person details from JSP file for updation . I don't know which service method will be first invoke
can you tell me ?


Thanks in advance

Lakshman
 
Bob Robinson
Greenhorn
Posts: 1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming is an HttpServlet, it will call service() then doPost() (assuming your FORM action = "POST").

According to the docs, service() "receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class... There's no need to override this method. "

Bob
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are compiled into classes that extend HttpServlet, and being servlets it's the service method that is called. Unless you've overridden that method, it will call one of the doXXX methods, depending on the HTTP method of the request. If you've overridden the service method then it will only do what you've written inside it.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except in extraordinary circumstances you should not be overriding service().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!