Http请求Get和Post的区别(HttpServlet)
来源:互联网 发布:梨园淘宝城 编辑:程序博客网 时间:2024/06/04 17:53
Http请求分两种形式一种是post,一种是Get,如下是展示案例
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>HttpServletTest</title></head><body><!-- web发请求 默认getget和post的区别是,1、get会把username&password信息带在网址上面2、小于2K,3、速度快优先级高1、post会把username&password信息隐藏起来 相对而言会更安全一些,2、大小没有限制,但是最好小于64K,3、提交会形成队列,所以会慢一点 --><form action="/MyHttpServlet/Three" method="post"> U:<input type="text" name="username"/><input type="submit" value="logon"/></form></body></html>
HttpServlet 服务器
package com.itcast;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class MyHttpServlet extends HttpServlet{private static final long serialVersionUID = 1L;//处理get请求public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException{PrintWriter pw = res.getWriter();pw.println("Sayhi to HttpServlet Get!!");}public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException{System.out.println("Post!!");res.getWriter().println("Sayhi to HttpServlet Post!!");}}
当Html用Post方式提交的时候 页面会返回Sayhi to HttpServlet Post!!
当Html用Get方式提交的时候 页面会返回Sayhi to HttpServlet Get!!
0 0
- Http请求Get和Post的区别(HttpServlet)
- HTTP请求:POST和GET的区别
- Http Post 和 Get的请求区别
- HTTP请求GET和POST的区别
- http请求的get和post区别
- http get和post请求的区别?
- http get和post请求的区别
- http请求get请求和post请求的区别
- Http请求的get 和 post的请求的区别
- Http请求的get 和 post的请求的区别
- HTTP的post请求和get请求的区别
- HTTP中GET请求和POST请求的区别
- http协议中,get请求和post请求的区别
- HTTP请求(GET与POST区别)和HTTP响应
- 面试-Http的请求方式GET和POST的区别
- http请求的post和get方式的区别
- HTTP中GET和POST请求区别
- HTTP请求方式GET和POST的区别详解
- Comparation of three Codes: RZ, NRZ, NRZI
- Android权限大全
- input 框上传多个文件
- 二维运动物体简单碰撞判断
- Android图片缓存之初识Glide
- Http请求Get和Post的区别(HttpServlet)
- MFC中使用teechart控件绘制二维及三维图的方法
- MD5Encoder加密转String
- 关于.net程序集
- 如何利用自尊心强的人
- 有名管道写练习
- POJ1006: 中国剩余定理的完美演绎
- 第一篇:写点啥呢?
- 秋招百度Android面经