A few questions on GET and POST methods when used in JSPs... 1. Is there any limit on these methods over density of data? 2. If yes,which of these 2 methods can handle more data? and what's that limit? 3. where should one use which method in particular? answers...?
Hi u can send more data by using post method.This is supposed to be secured when compared to Get method becoz the datas are not transferred as query string in case of post but in get this is done by passing as a query string. hope this will help -regards Rudhra
Hi this has been discussed at this thread http://www.javaranch.com/ubb/Forum7/HTML/002665.html Lets answer your questions all the same 1. limits on density of data: I hope you mean amount of data.. Get can handle much lesser data than Post.. Get can handle as much data as can be appended to the URL (I guess you know that 'Get' data is passed as part of URL).. Now that means it is browser dependent (I'm not sure of this).. All the same 1000 bytes is considered widely as a limit.. As for Post, theoretically it can carry any amoun t of data since now the data is part of the HTTP body... However it makes sense to keep in mind that the lesser data you pass the better.. network etc etc.. 2. I guess 1. answers this 3. It is basically more secure to use Post since data is not appended to the URL and is not visible explicitly.. However even Post data is easily retreivable and one should adopt other security mechanisms if the data needs to be secured such as in a transaction based site... I have quoted below as is from Art Metzers posting in the other mentioned thread.. According to Jason Hunter, author of JavaServlet Programming (an excellent book on the topic of servlets, by the way), "In practice, the use of GET and POST has strayed from the original intent....Just remember that GET requests, because they can be bookmarked so easily, should not be allowed to cause damage for which the client could be held responsible. In other words, GET requests should not be used to place an order, update a database, or take an explicit client action in any way." (p. 17)