HTTP Status 405 - HTTP method POST is not supported by this URL java servlet

后端 未结 5 2079
野性不改
野性不改 2020-12-03 10:21

I am having trouble getting the page to work. I have my form method to post and my servlet implements doPost(). However, it keeps showing me that I am not suppo

5条回答
  •  爱一瞬间的悲伤
    2020-12-03 10:53

    This happened to me when:

    • Even with my servlet having only the method "doPost"
    • And the form method="POST"

    • I tried to access the action using the URL directly, without using the form submitt. Since the default method for the URL is the doGet method, when you don't use the form submit, you'll see @ your console the http 405 error.

    Solution: Use only the form button you mapped to your servlet action.

提交回复
热议问题