get和post的区别并非在地址栏中看到的那么简单,二者的不同来自于协议本身。向服务器发送请求的形式不同。
GET/zl/login.jsp?username=vonzhou&password=vonzhou HTTP/1.1(CRLF)
Host:127.0.0.1
......
Connection: keep-alive
POST /zl/login.jsp HTTP/1.1(CRLF)
Host:127.0.0.1
......
Connection: keep-alive(CRLF)
(CRLF)
username=vonzhou&password=vonzhou
另外,
doGet is used when there is are requirement of sending dataappended to a query string in the URL. The doGet models the GET methodof Http and it is used to retrieve the info on the client from some server as arequest to it.The doGet cannot be used to send too much info appended as a querystream. GET puts the form values into the URL string. GET is limited toabout 256 characters (usually a browser limitation) and creates reallyugly URLs.
POST allows you to have extremely dense forms and pass that to theserver without clutter or limitation in size. e.g. you obviously can'tsend a file from the client to the server via GET. POST has no limit on the amount of data you can send and because the data does not show up on the URL you can send passwords. But this does not mean that POST is truly secure. For real security you have to lookintoencryption which is an entirely different topic