jQuery in Action, 2nd edition*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt on doHead Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt on doHead" Watch "Doubt on doHead" New topic
Author

Doubt on doHead

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

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

Joined: May 25, 2009
Posts: 296

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


Thanks & Regards, Sumeet
SCJP 1.4, SCWCD 5, LinkedIn Profile
Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

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

Joined: Dec 17, 2007
Posts: 180

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

Joined: Oct 14, 2010
Posts: 218
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.


Thanks
Vipul Kumar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on doHead
 
Similar Threads
Servlet becomming slow
Servlet becomming slow
Enumeration
servlet help me
java.util.Enumeration