ããéè¿ç¨åºéåhttp请æ±çææåæ°æ¾å°hashmapä¸ï¼ç¨çæ¶åæ¹ä¾¿äºã
ããå¦æåæ°å¼æä¸æï¼é£ä¹éè¦å¨ç¨åºä¸æ·»å filter转ç ï¼æè
å¨ä¸é¢ç¨åºéï¼å¯¹paramValue转ç
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
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("åæ°ï¼" + paramName + "=" + paramValue);
map.put(paramName, paramValue);
}
}
}
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("åæ°ï¼" + paramName + "=" + paramValue);
map.put(paramName, paramValue);
}
}
}
}
温馨提示:答案为网友推荐,仅供参考