get请求与post请求之异同

Scoket

Scoket与ServerSocket用于近距离传输.
客户端:
Socket s=new Socket(“IP地址服务器”,port);
InputStream s.getInputStream()
OutputStream s.getOutputStream()
服务端:
ServerSocket ss=new ServerSocket(int port); //10086
Socket s=ss.accpte(); 阻塞的

多线程的两种应用方法:
1.new Thread(new Runnable(){
Public void run(){
//获取文件
}

2.new Thread(new MyThread()).Start();
Class MyThread implements Runnable{
Public void run(){
}
}

网页结构:

<!DOCTYPE html>     网页的标准是Html5
    <html>
      <head>
        <meta charset="utf-8">   设置网页编码标签 meta :标签
        <title>设置网页标题</title>

      </head>
      <body>
         网页的主体
          <h1>~<h6>标题标签   由大变小   效果  加粗  换行
      </body>
</html>

css 样式

<style type="text/css">

Div:块级元素,自动换行。使用float使其居于一行。
div{
//标签 针对所有的div标签
width: 300px; 设置宽度 width
height: 100px; 设置高度
background-color: red; 设置背景色
border: 5px solid(实现)|dashed(虚线) green; 设置边框 值: 边框的粗细 边框的样式 边框颜色 solid实线 dashed 虚线 dotted 点状线
float: left; div是块级元素 自动换行 如果想让块在一行显示则通过float属性实现 值:left right none
}
“# id2 {” id样式 id是唯一 类似身份证
”#id名{“” id样式 具体样式应用到某一个标签上}
padding: 20px; //内边距 内容距离边框的距离 padding:20px 表示四个方向都是20px
margin-left:20px; //如果不想四个方向: margin-left padding-left
margin-right:20px; margin: 外边距 一个元素距离另一个元素距离
}

表单标签:

<form method="get/post">
      文本框: <input type="text" name="userName"/>   
      密码框: <input type="password" name="pwd"/>
</form>

get请求实例:
http://localhost:8080/project0726T/form.html?username=duyb&pwd=1122
post请求实例:
http://localhost:8080/project0726T/form.html
比较:
       get           post
1.安全性:安全性低          安全性高
2.长 度: 长度有限制256byte     没有长度限制
3.可见性: 可以在URL地址栏看到 post看不到 内容写在http head 协议头中
Header: head 协议的版本 content:
4.编码类型(enctype):
application/x-www-form-urlencoded(get请求默认) 单纯的表单提交multipart/form-data 文件提交+表单提交
Text/plain 对空格编码成 +号
application/x-www-form-urlencoded或者multipart/form-data (post)

统一编码
request.setCharacterEncoding(“utf-8”);
response.setCharacterEncoding(“utf-8”);
response.setContentType(“text/html;charset=utf-8”);
//用于接收get请求的内容 userName=111111
String name=request.getParameter(“userName”);
String pwd=request.getParameter(“pwd”);
System.out.println(name+”\t”+pwd);

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值