Back to the Konsensys

Back to Tips
HTTP POST versus HTTP GET
by
George Van Treeck

Both have their advantages and disadvantages. GET is where you append a long string of parameters after a URL. POST sends the paramters in the body of a request rather than the head.

For database applications using many fields or some very large fields (like large text area fields), the length of the string of parametners (called the query string) will often be larger than browsers can handle. For example, the IE browser can only handle GET query strings up to 2048 bytes. In such cases, you have little choice but to use HTTP POST. Further, with database applications, the data often changes. So, you don't what people bookmarking or emailing URLs that will quickly become invalid when the database content changes. So, again, POST is better for some types of database application. But, POST requires a lot more user interface coding to make it easy users. See the discussion Disabling the Browser Back Button.

GET is easier to use. Web crawlers can follow URLs with query strings. Web crawlers can not crawl an application that uses POST. POST applications generally use buttons rather links anyway.

My advice is to alway use GET unless you have no choice. When you have no choice but to use POST, consider using the Konsensys DreamBeans tool. DreamBean uses POST because it is designed for large database applications. Fortunately, it generates all the nasty POST user interface handling and AJAX handling code for you. But, if I were to write a small app, I'd probably use GET and PHP or JSP.


Copyright (C) 2010 George Van Treeck. All rights reserved.