直接上程式碼,僅供參考:
private void showParams(HttpServletRequest request) {
Map map = new HashMap();
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
if (paramValue.length() != 0) {
map.put(paramName, paramValue);
}
Set<Map.Entry<String, String>> set = map.entrySet();
System.out.println("------------------------------");
for (Map.Entry entry : set) {
System.out.println(entry.getKey() + ":" + entry.getValue());
直接上程式碼,僅供參考:
private void showParams(HttpServletRequest request) {
Map map = new HashMap();
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
if (paramValue.length() != 0) {
map.put(paramName, paramValue);
}
}
}
Set<Map.Entry<String, String>> set = map.entrySet();
System.out.println("------------------------------");
for (Map.Entry entry : set) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
System.out.println("------------------------------");
}