• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet does not receive PUT http method

 
Sotirios Delimanolis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a basic HttpServlet class acting as a FrontController. It has the doGet(), doPut(), getPost(), and doDelete() methods overridden. In my UI, I try GET, it works. I try POST, it works. If I try a PUT method through a regular html form, the Serlvet receives a GET request. I've been looking around and it seems this is a Tomcat configuration problem.

I am running Tomcat 7. Does anyone know how to overcome this?

Thanks
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sotirios, could you post the html code and the Servlet code?

When you post it, wrap your code with the code tag.

AAAnd, welcome to JavaRanch
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has nothing at all to do with Tomcat. HTML does not support anything but GET and POST in forms. Anything else is turned into a GET.
 
Sotirios Delimanolis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed.

Is there a way to make a PUT request through html then?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. But you can do so via JavaScript and Ajax.
 
Sotirios Delimanolis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I've read some more forum entries and because I don't want to learn javascript and ajax right now, I'm just going to do a Post request and pass a hidden parameter as the method I really want.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic