When the number of passed parameters is not fixed and the parameter names are not repeated, the method of obtaining the value:
//Get the parameter name of the enumeration type, if the parameter name is repeated, only the first one can be obtained
Map map = new HashMap();
- Enumeration enum =this.getRequest().getParameterNames();
- while (enum.hasMoreElements()) {
- String paramName = (String) enum.nextElement();
- String paramValue = this.getRequest().getParameter(paramName);
- / / Form the map corresponding to the key value
- map.put(paramName, paramValue);
- }