本文记录的是使用Java获取Http请求中的参数,包括Get和Post请求。
###获取Get请求中的参数 1
2
3
4
5
6
7
8
9
10protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String params = req.getQueryString();
PrintWriter pw = resp.getWriter();
pw.write("you get request is success: query params = " + params);
pw.flush();
pw.close();
pw = null;
}