aspose file tools*
The moose likes Servlets and the fly likes Servlet does not receive PUT http method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet does not receive PUT http method" Watch "Servlet does not receive PUT http method" New topic
Author

Servlet does not receive PUT http method

Sotirios Delimanolis
Greenhorn

Joined: Nov 07, 2011
Posts: 3
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

Joined: Jul 14, 2010
Posts: 754

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


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sotirios Delimanolis
Greenhorn

Joined: Nov 07, 2011
Posts: 3
Indeed.

Is there a way to make a PUT request through html then?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

No. But you can do so via JavaScript and Ajax.
Sotirios Delimanolis
Greenhorn

Joined: Nov 07, 2011
Posts: 3
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet does not receive PUT http method