獲取request中的查詢引數

劍握在手發表於2015-01-15
//獲取request中的查詢引數
    public static Map<String, Object> getRequestParamsByMap(HttpServletRequest request) {
        Map<String,Object> qmap=new HashMap<String,Object>();
        Enumeration<String> paraNames = request.getParameterNames();
        while(paraNames.hasMoreElements()) {
            String paraName = paraNames.nextElement();
            String paraValue = request.getParameter(paraName);
            if(!S.isNull(paraValue)) {
                if(paraName.indexOf("Time")!=-1||paraName.indexOf("Time")!=-1) {
                    qmap.put(paraName,request.getParameter(paraName));
                }else {
                    qmap.put(paraName,"%"+request.getParameter(paraName)+"%");
                }
                
            }
        }
        return qmap;
    }

 

相關文章