发起请求的几种方式
作者:互联网
一.地址栏(get)
直接请求一个路径下的资源:
http://localhost:8080/httptest/login.html
带查询参数:
http://localhost:8080/httptest/test?name=tom&age=1&id=1&id=3
二.超链接(get)
<a href="http://localhost:8080/httptest/test?name=tom&age=1&id=1&id=3"></a>
三.表单(post)
表单的请求方式一般使用post,在传递参数时name作为标识,value中存值
<form action="url" method="post"> <input type="text" name="name" /> <br /> <input type="text" name="age" /> <br /> <input type="radio" name="gender" value="男" checked="checked"/>男 <input type="radio" name="gender" value="女"/>女 <br /> <input type="checkbox" name="favors" value="football"/>Football <input type="checkbox" name="favors" value="book"/>book <input type="checkbox" name="favors" value="java"/>java <br /> <select name="city" multiple="multiple" size="5"> <option value="1">北京</option> <option value="2">成都</option> <option value="3">重庆</option> </select> <input type="submit" value="提交" /> <br /> </form>
标签:http,请求,发起,get,几种,post,id,localhost,name 来源: https://www.cnblogs.com/liyanglin/p/13210541.html