• 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

doPost() while using request dispatcher

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
Why can't we use doPost() when using request dispatcher.
I have two servlets where the first servlet is dispatching request to second servlet. The servlets are working fine when i am using doGet() method for both. When i tried to use doPost() method in both of them i am getting the following error.
HTTP Status 405 - HTTP method GET is not supported by this URL
--------------------------------------------------------------------------------
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

--------------------------------------------------------------------------------
Apache Tomcat/4.1.27
----------------------------------------------------------------------
Exaplation appreciated

Regards
Suresh k
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Suresh,
I guess that you typed the URL of the servlet in the browser directly, if this is your case, the problem is that the browser sends a HTTP GET request to you web server, and your servlet does not have a doGet method, so the servlet does not support the HTTP GET method!
Since the browser sends a request with HTTP GET method if you type the URL in the browser directly, the servlet that you type in the browser must implement the doGet method! But other servlets using request dispatcher to include/forward may implement the doPost method only!
[ January 28, 2004: Message edited by: Jacky Chow ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic