Wednesday, February 04, 2004

request parameters

very useful snippet:


public static String getRequestParameters( HttpServletRequest aRequest)
{
StringBuffer aReturn = new StringBuffer("");
Enumeration parameterNames = aRequest.getParameterNames();
while (parameterNames.hasMoreElements()) {
String requestParameter = (String) parameterNames.nextElement();
String[] aValues = aRequest.getParameterValues(requestParameter);
for (int i = 0; i <> 0) {
aReturn.append("&");
}
aReturn.append(requestParameter);
aReturn.append("=");
aReturn.append(aValues[i]);
}
}
return aReturn.toString();
}

}

No comments: