File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes HTTP Status 405 error comes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 405 error comes" Watch "HTTP Status 405 error comes" New topic

HTTP Status 405 error comes

bhavesh bhatnagar

Joined: Jun 15, 2009
Posts: 26
Guys i am learning Servlets ..

doing a Login & password page

on Index.http ..i have given
<form method ="post" action="LoginServlet">

on LoginXML.xml .. i have given



and on Servlet..
i have overriden doPost() Method.

but this error comes every time ..
HTTP Status 405 - HTTP method GET is not supported by this URL

i didnt understand.. whats wrong with this code
any help
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
If client is requesting with get method,then we have to overide doGet() method.otherwise doPost() has to be overidden.If we couldnt predict which method is being used for requesting the servlet,you can overide both doGet and doPost() method.

If we go on this way,we dont need to bother about which method our browser supports or from method the client is requesting.Our servlet can respond for any kind of request coming from client.

Ujjwal B Soni <baroda, gujarat, india> <+918866008962>
"Helping hands are better than praying lips......"
bhavesh bhatnagar

Joined: Jun 15, 2009
Posts: 26
thanks for your help
Program runs
I agree. Here's the link:
subject: HTTP Status 405 error comes
It's not a secret anymore!