request怎么獲取參數(shù) 如何獲取request請求中的參數(shù)?
如何獲取request請求中的參數(shù)?私有void showParams(HttpServletRequest request){Map Map=new HashMap()枚舉參數(shù)名=request.g
如何獲取request請求中的參數(shù)?
私有void showParams(HttpServletRequest request){
Map Map=new HashMap()
枚舉參數(shù)名=request.getParameterNames()
當(dāng)(paramNames.hasMoreElements參數(shù)()){
字符串paramName=(字符串)paramNames.nextElement參數(shù)()
字符串[]參數(shù)值=request.getParameterValues(paramName)
如果(參數(shù)值。長度==1){
字符串paramValue=paramValues[0
]如果(參數(shù)值長度() != 0) {
地圖輸入(paramName,paramValue)
}
}
}
集合<Map.Entry和ltString,字符串>>集合=地圖入口集()
系統(tǒng)輸出打?。ā?-----------------------------”)(地圖輸入條目:set){系統(tǒng)輸出打印(entry.getKey文件() ":" entry.getValue文件())
}
系統(tǒng)輸出打印("------------------------------")
}