Java Web 01: 什么是http协议

1.

 2.

 3.  请求和相应的数据包具体什么样子

<1>  get方式下请求和响应的数据包是什么样子

通过get方式传递数据:

   1.可以通过发送网址(URL)直接传递数据,例如:

    localhost:8080/web01/index.jsp?username=siki&password=123456

    此时, 服务器端并没有处理这个参数

   2. 接收参数, 需要使用request 这个内置的对象:

    <%

      String username = request.getParameter("username");

      String username = request.getParameter("password");

      System.out.println("username = " + username);  // 把username输出到 console

      System.out.println("password = " + password);  // 把password输出到 console

    %>

   3. 效果

    

<2>  通过post方式向服务器端发送请求

1. 示例

<br/>
登录
<form action = "login.jsp" method = "post"> <!-- 表示将form提交到页面"login.jsp", 并指定请求方式为 post -->
  <input type = "text" name = "username"/>
  <input type = "password" name = "password"/>
  <input type = "submit" />
</form>

2. 效果:

 

 

3. 数据包长什么样子

原文地址:https://www.cnblogs.com/JasperZhao/p/13471601.html