Getting servlet: request volume data acquisition request

. 1 @WebServlet ( "/ RequestDemo5" )
 2  public  class RequestDemo5 the extends the HttpServlet {
 . 3      protected  void the doPost (the HttpServletRequest Request, the HttpServletResponse Response) throws ServletException, IOException {
 . 4          // acquiring request message body - the request parameter
 . 5  
. 6          // 1. Get character stream 
. 7          the BufferedReader br = request.getReader ();
 . 8          // 2. read data 
. 9          String Line = null ;
 10          the while (! (= br.readLine Line ()) = null ) {
11             System.out.println(line);
12         }
13     }
14 
15     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
16 
17     }
18 }

 

Guess you like

Origin www.cnblogs.com/flypig666/p/11480376.html