What Is doPost

The doPost() method is called by the server (via the service method) to allow a servlet to handle a POST request. Generally, we use the doPost() method for sending information to the server like HTML form data.

Why doPost method is preferred over doGet method in PHP?

You should use doGet() when you want to intercept on HTTP GET requests. You should use doPost() when you want to intercept on HTTP POST requests. That’s all. Do not port the one to the other or vice versa (such as in Netbeans’ unfortunate auto-generated processRequest() method).

WHO calls doGet () and doPost () method?

If the HTTP Method is a GET, the service() method calls doGet(). If the HTTP request Method is a POST, the service() method calls doPost().

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest