When is doPut() called in a servlet?

13,375

Solution 1

The doPut() method handles requests send by using the HTTP PUT method. The PUT method allows a client to store information on the server. For an example, you can use it to post an image file to the server. As the above answer says, goGet() and doPost() are in use, mostly. In my case, I use only these two, and I am getting only get requests, so I simply transfer the get request to doPost() and do my job easily.

Solution 2

When an HTTP PUT request is received, naturally.

Can a page do a PUT request by code?

The only valid method attribute values of a <form> are get and post, according to the HTML5 spec. I assume that's what you're asking.

Share:
13,375
Rajeshwar
Author by

Rajeshwar

Updated on June 06, 2022

Comments

  • Rajeshwar
    Rajeshwar almost 2 years

    Hi I was just curious when is the doPut() method in a servlet called. I know that if the form on a jsp/html page has a "post" method then the doPost() is called otherwise if it has a "GET" then the doGet() is called.When is the doPut() called ??

  • Neil Coffey
    Neil Coffey almost 12 years
    Or put another way, if you don't know when you're expecting to receive a PUT request, that probably means you don't need to care about it.
  • PeakGen
    PeakGen almost 12 years
    Then they have copied that from my book, my diploma It is in NIIT Master mind series, j2ee web components-1, page number 1A.11
  • PeakGen
    PeakGen almost 12 years
    Thanks BalusC, Thank you letting me know. I really appreciate it :)
  • PeakGen
    PeakGen almost 10 years
    @MaDu_LK: Don't play here and there if you are new to StackOverflow, read the above comments first.