This piece of utility code would print all the key-value pairs in the request object.
Here in the above code "request" is an object of "HttpServletRequest".
Map<String, String[]> params = request.getParameterMap(); Iterator<String> i = params.keySet().iterator(); while ( i.hasNext() ){ String key = (String) i.next(); String value = ((String[]) params.get( key ))[ 0 ]; System.out.println("Requst Params Key: ["+key+"] - Val: ["+value+"]"); }
Here in the above code "request" is an object of "HttpServletRequest".
No comments:
Post a Comment