将request中的所有参数存放到自定义的map中

    /**
     * <获取参数map>
     * 
     * @return 参数map
     * @throws Exception 
     */
    protected Map<String, Object> getParameterMap(HttpServletRequest request) throws Exception {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        Map<String, String[]> tempMap = request.getParameterMap();
        Set<String> keys = tempMap.keySet();
        for (String key : keys) {
            byte source [] = request.getParameter(key).getBytes("iso8859-1");
            String modelname = new String (source,"UTF-8");
            resultMap.put(key,modelname);
        }
        return resultMap;
    }

猜你喜欢

转载自u012081441.iteye.com/blog/2382950