• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Invoking doPost() method of a servlet from another servlet

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for more please refer to this thread
 
reply
    Bookmark Topic Watch Topic
  • New Topic