API开发实践(二) 接受url请求

先简单理解GET请求与POST请求的区别

HTTP请求中POST与GET的区别

 

在浏览器地址栏输入

http://服务器地址:服务器端口/文件路径

即可访问目的文件或服务

 

如果带有参数就以

?参数名=参数值[&参数名=参数值].*

的形式添加到请求中,再在服务器中用request.getParameter()方法取出。

 

代码:url:  http://localhost:8080/APITest/getMap.java?shipperCode="*"&logisticCode="*"

1 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
2         // TODO Auto-generated method stub
3         String shipperCode = request.getParameter("ShipperCode");
4         String logisticCode = request.getParameter("LogisticCode");
5         
6     }

改写了POSTt方法,

posted @ 2017-05-21 11:15  海森堡不如我侧的准  阅读(225)  评论(0编辑  收藏  举报