August 2, 2009

HTTP Status 405 - HTTP method POST is not supported by this URL

Topic:  Servlets 2.4

Application Server: JBoss 4.0.2 / Tomcat 5.5.9

Exception:

HTTP Status 405 - HTTP method POST is not supported by this URL


type Status report

message HTTP method POST is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).

Resolution:

Either you are sending a GET request from the browser with only a doPost() method in your Servlet class or the opposite – sending a POST request with only a doGet() in your Servlet class.

Servlet methods – doGet(), doPost() catch only the respective requests, so to handle a GET you need to put a doGet() and to receive a POST you need a doPost() in the Servlet class.

If you did put the right method, make sure you got the method signature as well as the method name right – its doGet() with a small 'd' and a capital 'G'. Same for doPost()

No comments:

Post a Comment