当前位置:网站首页>doGet与doPost
doGet与doPost
2022-07-25 16:03:00 【clear0217】
doGet与doPost
一、简介
1、doGet
doGet 调用用于获取服务器信息,并将其做为相应放回给客户端。经由Web浏览器或通过HTML、JSP直接访问Servlet的URL时,一般用Get调用
2、doPost
它用于客户端把数据传送到服务器端,是可以隐藏传送给服务器的任何数据。Post适合发送大量的数据。
二、区别
1、生成方式
get生成方式有四种:1)直接在URL地址栏中输入URL。2)网页中的超链接。3)form中method为get。4)form中method为空时,默认是get提交。
post生成方式:form中method属性为post。
2、数据传送方式
get方式:表单数据存放在URL地址后面。所有get方式提交时HTTP中没有消息体。
post方式:表单数据存放在HTTP协议的消息体中以实体的方式传送到服务器。
3、服务器获取数据方式
GET方式:服务器采用request.QueryString来获取变量的值。
POST方式:服务器采用request.Form来获取数据。
4、传送的数据量
GET方式:数据量长度有限制,一般不超过2kb。因为是参数传递,且在地址栏中,故数据量有限制。
POST方式:适合大规模的数据传送。因为是以实体的方式传送的。
5、安全性
GET方式:安全性差。因为是直接将数据显示在地址栏中,浏览器有缓冲,可记录用户信息。所以安全性低。
POST方式:安全性高。因为post方式提交数据时是采用的HTTP post机制,是将表单中的字段与值放置在HTTP HEADER内一起传送到ACTION所指的URL中,用户是看不见的。
6、在用户刷新时
GET方式:不会有任何提示、
POST方式:会弹出提示框,问用户是否重新提交
边栏推荐
猜你喜欢

General test case writing specification

Ml image depth learning and convolution neural network

leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】

0x80131500打不开微软商店的解决办法

使用Huggingface在矩池云快速加载预训练模型和数据集

聊聊如何用 Redis 实现分布式锁?

Crazy God redis notes 12
![Leetcode:528. select randomly according to the weight [ordinary random failure + prefix and dichotomy]](/img/fb/8178388f8c9ac80d95140378d24238.png)
Leetcode:528. select randomly according to the weight [ordinary random failure + prefix and dichotomy]
![[wechat applet] detailed explanation of applet host environment](/img/57/582c07f6e6443f9f139fb1af225ea4.png)
[wechat applet] detailed explanation of applet host environment
![Leetcode:154. find the minimum value II in the rotation sort array [about the middle and rear positioning dichotomy of the rotation sort array]](/img/03/54a2d82a17cd07374dc0aedacd7b11.png)
Leetcode:154. find the minimum value II in the rotation sort array [about the middle and rear positioning dichotomy of the rotation sort array]
随机推荐
一文入门Redis
Circulaindicator component, which makes the indicator style more diversified
01.一个更简单的方法来传递大量的props
MySQL intent lock
终极套娃 2.0 | 云原生交付的封装
MySQL global lock
一文理解分布式开发中的服务治理
Huawei 2023 starts to warm up in advance! Zuo Shen's program code interview guide comes in handy
R语言使用gt包和gtExtras包漂亮地显示表格数据:gt_bar_plot函数和gt_plt_bar_pct函数可视化百分比条形图、原始数据的百分比条形、缩放后的数据的百分比条形、指定数据对齐宽度
Equivalent change of resistance circuit (Ⅱ)
30 lines write the concurrency tool class yourself (semaphore, cyclicbarrier, countdownlatch)
[Shakespeare: keep the fun of being a man]
MySQL tutorial 65 data in MySQL operation table
Exploration of 6-wire SPI transmission mode
Intention lock
Exclusive lock
How matlab saves all the data after running
Lazy loading of pictures
Wavelet transform --dwt2 and wavedec2
MySQL tutorial 71-where conditional query data