Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Servlet issue

 
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
 
Greenhorn
Posts: 1
Spring Java
  • 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
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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.
 
Marshal
Posts: 67415
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except in extraordinary circumstances you should not be overriding service().
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic