将request.getParameterMap()转换成可操作的普通Map

   /**
 * 从request中获得参数Map,并返回可读的Map
 * 
 * @param request
 * @return
 */
@SuppressWarnings("unchecked")
public static Map getParameterMap(HttpServletRequest request) {
	// 参数Map
	Map properties = request.getParameterMap();
	// 返回值Map
	Map returnMap = new HashMap();
	Iterator entries = properties.entrySet().iterator();
	Map.Entry entry;
	String name = "";
	String value = "";
	while (entries.hasNext()) {
		entry = (Map.Entry) entries.next();
		name = (String) entry.getKey();
		Object valueObj = entry.getValue();
		if(null == valueObj){
			value = "";
		}else if(valueObj instanceof String[]){
			String[] values = (String[])valueObj;
			for(int i=0;i 
 

你可能感兴趣的:(JavaEE)