I have a servlet which overrides doHead() and doGet().
I have a JSP with a form action to call the servlet, the form method="HEAD" and a submit button.
However, the doGet() gets called instead of the doHead() in the servlet.
I have read that a HEAD is a GET but I was expecting the request to pass through doHead() first and then doGet().
When will the doHead() method be called in a servlet?
Thanks in advance
posted 8 years ago
HTML forms do not support anything but GET and POST. If you try to use something other than POST, it will be a GET.
Another possibility is to tunnel the other methods through HTTP POST by using a URI query string like POST /myWebApp?method=PUT (and/or the X-HTTP-Method-Override header). Of course you will need to adjust your doPost() method ...