Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doPost()  RSS feed

 
Natesh Kurup
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My custom servlet extends HttpServlet. HttpServlet has doPost method defined as shown below


If my servlet has to handle Post request why do I need to override the doPost method ?

As it extends HttpServlet it should find the method in the super class.

Thanks & Regards

NK
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method in the superclass throws an exception stating that "this servlet does not handle the POST method".
[ January 19, 2005: Message edited by: Ben Souther ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If my servlet has to handle Post request why do I need to override the doPost method ?

So your servlet will actually do something when it receives a POST request. Otherwise it will just do whatever is defined in HttpServlet's doPost() method.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Sturrock:
Otherwise it will just do whatever is defined in HttpServlet's doPost() method.


Such as:
throw an exception stating that "this servlet does not handle the POST method". ;-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!