August 2, 2009

Servlets: The requested resource is not available

Topic:  Servlets 2.4

Application Server: JBoss 4.0.2

Exception: The following message is displayed in the browser:

HTTP Status 404 -


type Status report

message

description The requested resource ( … ) is not available.

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