【求助】struts2中在不知道form表单参数有多少和不知道参数名的时候如何取值
struts2中在不知道form表单参数有多少个也不知道参数的名的时候在action中应该怎么得到这些参数名和值呢。急求答案,多谢各位! struts action form
[解决办法]
HttpServletRequest对象有getParameterMap()这个方法
里面就是表单提交过来的所有数据了
[解决办法]
HttpServletRequest的getParameterMap();返回的就是所有提交过来的参数和参数值了
[解决办法]
Enumeration e=request.getParameterNames();
while(e.hasMoreElements()){
String name=(String) e.nextElement();
value=request.getParameter(name);
System.out.println(name+"="+value);
}