Through the program, iterates through all parameters of http request and puts them into hashmap, which is convenient for use.
If the parameter value has Chinese, you need to add filter transcoding to the program, or in the following program, transcoding to paramValue transcoding in the following program
As shown below:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map map = new HashMap(); Enumeration paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); String[] paramValues = request.getParameterValues(paramName); if (paramValues.length == 1) { String paramValue = paramValues[0]; if (paramValue.length() != 0) { System.out.println("parameter:" + paramName + "=" + paramValue); map.put(paramName, paramValue); } } } } }The above is the entire content of all the parameters implementation methods for traversing the request http request from Java, I hope it will be helpful to everyone, and I will support Wulin.com more~