Java Web笔记 - Servlet中的get和post方法HTTP协议实现的区别

发布于 2011-11-08 | 更新于 2020-09-20

get方法与post方法的区别:

① 浏览器地址栏显示不同

② 向服务器端请求时发送的消息格式不同

③ get请求消息格式为:

GET /HelloWorld/loginServlet?username=abc&password=abc HTTP/1.1

④ post请求消息格式为:

POST /HelloWorld/loginServlet HTTP/1.1

Connection:keep-Alive
username=abc&password=abc

通过浏览器进行文件上传时,一定要使用post方法。

通过浏览器地址栏输入网址的方式访问服务器资源,使用的都是get方法请求。

本文作者: arthinking

本文链接: https://www.itzhai.comservlet-get-and-post-methods-in-the-http-protocol-to-achieve-the-distinction.html

版权声明: 版权归作者所有,未经许可不得转载,侵权必究!联系作者请加公众号。

×
IT宅

关注公众号及时获取网站内容更新。