File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on doHead

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have overridden doHead() method in my servlet but when I am calling that servlet from a html with <form method="head"...>it gives me 405 - HTTP method GET is not supported by this URL

My Servlet

My html page calling servlet

 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are getting this error since your servlet is not overriding the doGet method.
The method attribute will only take GET or POST.
Check this link
 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method attribute will only take GET or POST.


but when I change doHead to doGet in my servlet code then it works !!
 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think in HTML every http method is treated as GET except POST.

whether it is a head,put,delete etc except POST,irrespective of http methods the browser will only send get request to the server.
 
vipul bondugula
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashok Pradhan wrote:I think in HTML every http method is treated as GET except POST.

whether it is a head,put,delete etc except POST,irrespective of http methods the browser will only send get request to the server.



Yes, Except POST all the methods request goes to doGet method. Again response will vary based on the method. if method="Head" , then only headers are returned in the response.

Thanks & Regards,
Vipul Kumar.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic