jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes ERROR : HTTP Status 405 - HTTP method GET is not supported by this URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "ERROR : HTTP Status 405 - HTTP method GET is not supported by this URL" Watch "ERROR : HTTP Status 405 - HTTP method GET is not supported by this URL" New topic
Author

ERROR : HTTP Status 405 - HTTP method GET is not supported by this URL

tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
i get this error when i try to call submitresume servlet from submitresume.html

code for submitresume.html



code for submitresume.java


if i change the get method to post in the submitresume.html and doGet to doPost in submitresume.java
after passing data from submitresume.html i get a blank page (not a post error) .

is the problem related to code or anything related to configuration ???

Do Right , Fear No Man
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

1. you have not defined doGet method in your code. That's why you get that error. Change doPost to doGet in your servlet or set the method of the form in your JSP to post (as you yourself said)

2. as far as the blank page is concerned, please check the source of the page that you get when you post your form. There is an error in the html that you generate on lines 54-59 in your servlet. Your body tag starts in your head tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
if you are using a GET method in the <form> tag then you have to define a doGet() method in your servlet, the blank page is caused because you have to close the output stream of the response after you write to it, you have to call out.flush(); and out.close();


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
omar al kababji wrote: the blank page is caused because you have to close the output stream of the response after you write to it, you have to call out.flush(); and out.close();


thanks Mr omar for reply
but i cannot understand where to put , after
</HTML>
or before it.
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
Ankit Garg wrote:Your body tag starts in your head tag...


changed but still no result , even restarted tomcat, restarted browser ,but no result
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
whenever you are extending HttpServlet you have to provide implementation of doGet() and doPost methods, otherwise default implementation will be called.
You can figure it out form the code, which is responsible for sending error code 405.


SCJP 1.5(97%) My Blog
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
for example like this

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Are you pressing the submit button or preview button. Your showalert method is sending output to System.out i.e. the console if available...
tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
shivendra tripathi wrote:
You can figure it out form the code, which is responsible for sending error code 405.


i did it exactly but , still blank screen.

please check my code , if there would have been a error it would have shown maybe there is an error in the display.

i am unable to figure it out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ERROR : HTTP Status 405 - HTTP method GET is not supported by this URL