1 @WebServlet("/RequestDemo5")
 2 public class RequestDemo5 extends HttpServlet {
 3     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 4         //获取请求消息体--请求参数
 5 
 6         //1.获取字符流
 7         BufferedReader br = request.getReader();
 8         //2.读取数据
 9         String line = null;
10         while((line = br.readLine()) != null){
11             System.out.println(line);
12         }
13     }
14 
15     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
16 
17     }
18 }

 

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2021-06-16
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-09-05
  • 2021-08-06
猜你喜欢
  • 2022-01-17
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案