POST方法

假设有个HTTP请求,浏览器获得如下HTTP响应:

HTTP/1.1 200 OK
Date: Tue, 12 Jul 2016 21:36:12 GMT
Content-Length: 431
Content-Type: text/html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your Title</title>
</head>
<body>
    <form id="login" name="login" method ="Post"  action="Post.html">
        Username:<input id="id1" name="txtUserName" type="text" /><br/>
        Password:<input id="id2" name="txtPWD" type="text" /><br/>           
        <input id="id3"  name ="subLogin" type="submit" value="submit123" />
    </form>
</body>
</html>

表单标签<form>用于收集用户的输入。其中method属性用于提交时,采取的HTTP方法。而action属性用于提交HTTP时的URL。当点击submit按钮时,向原http服务器发送了一个新的HTTP请求:

POST /Post.html HTTP/1.1
Host: 192.168.1.109:8080
Content-Length: 45

txtUserName=111&txtPWD=222&subLogin=submit123

POST方法是因为 method ="Post"这个属性;/Post.html资源是因为action="Post.html"这个属性。

HTTP服务程序应重新准备好Post.html的文本内容,发送会浏览器。

如此一来,HTTP服务程序与用户浏览器就可以进行“交互”了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值