Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on doHead

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • 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
  • 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
  • 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
  • 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: 223
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic