| Author |
why we use doGet() and doPost() in the place of service(ServletRequest req,servletResponse)
|
Ritesh raushan
Ranch Hand
Joined: Aug 29, 2012
Posts: 97
|
|
why we use doGet() and doPost() in the place of public void service(ServletRequest req,servletResponse resp).
we can also use service(ServletRequest req,servletResponse resp).
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3791
|
|
Why would you want to? It's much easier to use the provided methods.
The service() method is defined in GenericServlet, which was intended to be able to support different protocols. In practice you're always going to be using HTTP. The service() method is implemented in HttpServlet in a way that makes life simpler - it does all the mapping of HTTP requests for you, so all you need to do is implement the ones you want to use.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
we have an entry about it in ServletsFaq
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
Although most people make POST and GET do the same thing, that's a really bad practice. POST and GET should be used for very different things according to the way HTTP was designed.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: why we use doGet() and doPost() in the place of service(ServletRequest req,servletResponse)
|
|
|