• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys please help me with this.. when I try to run my servlet on server the above error occured.. As my code is about sending and receiving username and password I didn't use GET method. what should I do? Any help is much appreciated.

Below are my servlet class and index.html files.

Servlet class




Index.html



Regards,
Sapumal.



 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think your request is going where you think it's going. That "action=login" is not going to get you there. Do some searching on that form element and what the action attribute should look like.

btw, I assume this code is just an exercise or homework and not something that's ever going to be used in production. If you are really planning on writing your own login security then we need to have a serious talk.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your class extends HttpServlet - HttpServlet provides some basic methods plus stubs for all of the HTTP methods: GET, POST,PUT,DELETE. These stubs ALL respond with that "not supported" message. You the programmer must supply an overriding doGet method if you want your servlet to respond to the GET method.

Bill
 
Ranch Hand
Posts: 228
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@OP - can you please show your web.xml file.? or else can you annotate the servlet with "url pattern"?
 
Sapumal Bandara
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks people for every piece of advice.. After overriding doGet() the problem solved! i called doPost within doGet().
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sapumal Bandara wrote:Thanks people for every piece of advice.. After overriding doGet() the problem solved! i called doPost within doGet().


Where is the doGet getting called from? The form you posted is trying to use the post method.
 
J. Kevin Robbins
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sapumal Bandara wrote:Thanks people for every piece of advice.. After overriding doGet() the problem solved! i called doPost within doGet().



That's not a fix; it's an ugly hack. You still haven't fixed the issue, which is, why is the server seeing a GET request when you are sending a POST?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now for the 10,000 foot view:

According to the standard view of HTTP methods, GET and POST are not equivalent!

Treating them as equivalent has resulted in much bad architecture - unfortunately all over the web, but still bad architecture.

You will see references to RESTful architecture for web services. A RESTful architecture pays close attention to the proper use of the various HTTP methods.

Bill
reply
    Bookmark Topic Watch Topic
  • New Topic