wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Error 400: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Error 400:" Watch "Error 400:" New topic
Author

Error 400:

ramachandran swaminathan
Ranch Hand

Joined: Nov 27, 2006
Posts: 43
when iam doing 3rd chapter example in HFSJ book my servlet is producing following error Error 400: HTTP method GET is not supported by this URL

as well as when iam clicking the html submit button it shows page cannot found please help me.im sruggling this whole day


target scwcd.
Ashwin Kumar
Greenhorn

Joined: Oct 13, 2005
Posts: 27
If you HTML/JSP page has:

<form action="/someservlet">
...
</form>

make sure that the servlet class denoted by this URL pattern, properly implements "public void doGet(HttpServletRequest,HttpServletResponse)"

I think, you must have implemented "doPost()" in your servlet and not "doGet()". That could be reason for the error.

To avoid these scenarios couple your doGet() and doPost(), i.e., implement doGet() as follows:



SCJP 1.4<br />SCBCD 5.0<br />SCWCD 1.4 (Preparing)
kalpana ram
Ranch Hand

Joined: May 20, 2007
Posts: 38
Hi,

It means that you are not implemented doGet(request,response) in your servlet.

The default method for html form is Get and Not Post.Hence the servlet is looking for doGet method and not for doPost.
and one more thing to note is,the service method,looks the http method and calls that method in servlet.In this case it is Get and hence it calls doGet method.

regards
Kalpana.
Ken King
Greenhorn

Joined: Sep 17, 2007
Posts: 13
You should also make sure that your form has the POST method specified..

<form action="/someServlet" method="POST">
form stuff here
</form>
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
For the exam you will need to know that the Get method is the default if you do not indicate a method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error 400: