This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes how to invoke both doGet() and doPost() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to invoke both doGet() and doPost()" Watch "how to invoke both doGet() and doPost()" New topic
Author

how to invoke both doGet() and doPost()

vysh srini
Greenhorn

Joined: Apr 25, 2009
Posts: 25
Hi,

Can anyone tell me how to invoke both doGet() and doPost() method of the servlet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

For a single request? You don't. A request is either a GET or a POST, never both.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You might inside to the doGet call the doPost.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
yohan dsa
Greenhorn

Joined: Nov 17, 2005
Posts: 3
for a single request you cant. You may chose to overide doService and give call to both doPost & doGet if thts wht you want..
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

yohan dsa wrote: You may chose to overide doService


There is no such method doService. It is service(HttpServletRequest,HttpServletResponse)


Love all, trust a few, do wrong to none.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to invoke both doGet() and doPost()