생존기술_IT/JAVA

[JAVA] 루프로 돌려서 GET,POST로 들어온 파라메터들 나열하기..

LeCafeCreme 2020. 10. 4. 18:39

print_r()이 없어서 만듦..-_-ㅋ;;;;

    Enumeration<String> paramNames = request.getParameterNames();
    while(paramNames.hasMoreElements()) {
        String name = paramNames.nextElement().toString();
        String[] strList = request.getParameterValues(name);
        if(strList.length >= 1) {
            System.out.println("PARAM_NAME : " + name + "<br/>");
            for(int i=0 ; i < strList.length ; i++){
                System.out.println("ㄴ VAL_" + i + " : " + strList[i] + "<br/>");
            }
        } else {
            System.out.println("PARAM_NAME : " + name + "<br/>");
            System.out.println("ㄴ VAL_ : NO DATA<br/>");
        }
    }