request里有两个方法
request.getParameterMap();
request.getParameterNames();
我想用这两种方法获取。
1、用request.getParameterNames();
Enumeration enu=request.getParameterNames();
while(enu.hasMoreElements()){
String paraName=(String)enu.nextElement();
System.out.println(paraName+": "+request.getParameter(paraName));
}
2、request.getParameterMap();
Map map=request.getParameterMap();
Set keSet=map.entrySet();
for(Iterator itr=keSet.iterator();itr.hasNext();){
Map.Entry me=(Map.Entry)itr.next();
Object key=me.getKey();
Object keyvalue=me.getValue();
String[] value=new String[1];
if(keyvalue instanceof String[]){
value=(String[])keyvalue;
}else{
value[0]=keyvalue.toString();
}
for(int k=0;k<value.length;k++){
System.out.println(key+"="+value[k]);
}
}