/**
* 把request中的所有键值赋到bean
*
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
@SuppressWarnings("unchecked")
public static void populateReqBean(Object bean, HttpServletRequest request) {
HashMap map = new HashMap();
Enumeration names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
map.put(name, request.getParameterValues(name));
}
try {
BeanUtils.populate(bean, map);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}