JSP中request.getParameterNames和getParameterValues应用

 

try {
String name;  
Enumeration  pNames
=request.getParameterNames();  
 
while(pNames.hasMoreElements()){  
  name
=(String)pNames.nextElement();
  out.print(name
+"="+request.getParameter(name)); 
  }
 
}
catch (Exception e) {
out.print(e.toString());
}

 

 

for  (Enumeration iter  =  request.getParameterNames(); iter.hasMoreElements();)  {
            String element 
= (String) iter.nextElement();
            logger.debug(
"parameter:"+element);
            logger.debug(
"value:"+request.getParameter(element));
        }

 

String[]   userId    =    request.getParameterValues( " userId " );   

你可能感兴趣的:(经验技巧之JSP)