Yes using doPost method you can send bulk of data. doGet method has some limitations. you can't send over a specific amount of data using doGet. So use doPost method when you want to send a large data like Registeration forms etc.
And when you use doGet the data is shown in query string in your explorer's address bar but in case of doPost the data is not viewable in address bar. So when you want to send the secure data like password or other things like that use doPost.
Joined: Dec 04, 2001
First of all thanks for the reply I think u r not getting me I have asked what is the advantage of doGet over doPost.I know the difference of these two method.But my question is if doPost is secure and we can send unlimited data ,then what is the use of doGet method ? why SUN provide this doGet method.I want to know in which situation doGet is more effective than doPost.
Thanks & Regards Bikash
Joined: Mar 18, 2004
Ok sorry for misunderstanding. There are some situation where we have to use doGet instead of doPost. If you want to make a link for a Servlet or jsp and you want to pass 1 or 2 parameters using href tag of HTML. Then you will have to use doGet. When we write:
<a href="anyservlet?param=blabla">Click Here</a>
in this case it will call the doGet method instead of doPost of servlet. And if you want to use response.sendRedirect() to a page and you want to use any parameter in that then you will have to use doGet method
in these kinds of cases we will have to use doGet.
Unless specifically specified in an HTML for ALL HTTP traffic uses GET requests. Therefore if Sun had not supported GET requests you'd be completely and utterly unable to handle 90% or more of all HTTP traffic.
Simply typing the URI of your servlet in your browser and pressing enter would yield an error "GET not supported" or similar.