dcsimg
Q. suppose, one servlet extends HttpServlet is having .........
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, May 20, 2003 08:15 AM

Q. suppose, one servlet extends HttpServlet is having doGet(),doPost(),service() methods. My Question is, My request method is Post/Get. which method is executed ,doPost()/doGet() or service(), both of them contain same code/ some thing different?. Can I write these three methods in the same servlet?.

Re: Q. suppose, one servlet extends HttpServlet is having .........

Posted By:   Stijn_Fonck  
Posted On:   Tuesday, May 20, 2003 09:40 AM

Normally you don't overwrite service(). The service method will for you look after what type of method it is (get/post) and will call the doGet or doPost itself.

So if you want your servlet to do the same for a post as for a get you would implement service() or make sure doGet and doPost do the same job.

If you want doGet and doPost to do something else, you just give them another implementation.
About | Sitemap | Contact