• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet problem: error 405 HTTP Method GET

 
Laurent Bagno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've the following error : "405 - HTTP method GET is not supported by this url".
But the 'doGet' method of my servlet is comment.

I would like to that my servlet does'nt launch when the application starts. Moreover, I would want that my servlet be called when I click on the validation button that I created in my index.jsp in order to my servlet does a check-in of the username and the password typed by the user and after the check-in, the servlet does a redirection to another jsp page.

Do you have any ideas ?

Thank you

This is my code architecture of my Maven Project with tomcat as application server:



Web.xml :


MyServlet.java :


index.jsp :
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you commented out your doGet() method, why are you surprised that it doesn't work?
 
Laurent Bagno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If doGet method is comment or not, it's the same result :

HTTP Status 405 - HTTP method GET is not supported by this URL
 
Arun Giridhar
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Laurent Bagno wrote:If doGet method is comment or not, it's the same result :

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


See 405 get fired if the method is not supported for example, using GET on a form which requires data to be presented via POST. In your case your passing Query String means you need to have doGet(req,res) and not doPost(req,res). If you change the method in the form it will be vice versa.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are the methods protected?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic