This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invoking doPost() method of a servlet from another servlet  RSS feed

 
Sajee Joseph
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have a certain question.
I need to call the doPost() method of a servlet(Servlet B) from another servlet ( servlet A). I tried doing so using the RequestDispather.forward().
But by doing so the doGet() method is called instead. Please note that the Servlet B is already existing one & i dont have the liberty of calling the doPost() method from the doGet().
How can i achieve this?

Regards,
Saj
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sajee Joseph:
Hello all,

I have a certain question.
I need to call the doPost() method of a servlet(Servlet B) from another servlet ( servlet A). I tried doing so using the RequestDispather.forward().
But by doing so the doGet() method is called instead. Please note that the Servlet B is already existing one & i dont have the liberty of calling the doPost() method from the doGet().
How can i achieve this?

Regards,
Saj


Hi,

Two options are available.

1. If your current method type is post then it will automatically will forward to Post method.

2. Using the URLConnection Object you can call a servlet's doPost method.

Regards,
M.S.Raman
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for more please refer to this thread
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!