You are here:   HomeJava Servletintroduction to ServletWhat is the difference between doGet and doPost?
by Dinesh Thakur Category: introduction to Servlet

In doGet Method the parameters are appended to the URL and sent along with the information. Maximum size of data that can be sent using do Get it 240 bytes. Parameters are not encrypted. doGet method generally is used to query or to get some informationfromthe server.

doGet is faster if we set the response content length since the same connection is used. Thus increasing the performance. doGet should be important. doGet should be able to be repeated safely many times. doGet should be safe without any side effects for which user is held responsible.


In doPost, parameters are sent in separate line in the body. There is no maximum size for data. Parameters are encrypted. doPost is generally used to update or posts some information to the server. do Post is slower compared to doGet since do Post does not write the content length.

This method does not need to be important Operations requested through POST can have side effects for which the user can be held accountable, for example, updating stored data  or buying items online.

What's New and Popular

Search Content

Advance Courses

Basic Courses

Advertise with Us