*
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
Author

HTTP Status 405 error comes

bhavesh bhatnagar
Greenhorn

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

<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>LoginServlet</url-pattern>
</servlet-mapping>


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.


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

Joined: Jun 15, 2009
Posts: 26
thanks for your help
:
Program runs
 
Consider Paul's rocket mass heater.
 
subject: HTTP Status 405 error comes