This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doPost() while using request dispatcher

 
Suresh Khanna
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
 
Jacky Chow
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic