将前台参数传递给后台处理 用法:AppSysListVo appSysListVo = setParam(req.getParameterMap(), AppSysListVo.class);public static T setParam(Map paramMap, Class t){ try { T pojo = t.newInstance(); //遍历类中的变量 for (Fiel
用法: AppSysListVo appSysListVo = setParam(req.getParameterMap(), AppSysListVo.class); public staticT setParam(Map paramMap, Class t){ try { T pojo = t.newInstance(); //遍历类中的变量 for (Field field : t.getDeclaredFields()) { String[] value = (String[])paramMap.get(field.getName()); if(isNotEmpty(value)){ try { field.setAccessible(true); if(field.getType().isAssignableFrom(String.class)) field.set(pojo, value[0].trim()); else if(field.getType().isAssignableFrom(Integer.class)) field.set(pojo, Integer.valueOf(value[0])); } catch (Exception e) { e.printStackTrace(); continue; } } } return pojo; } catch (Exception e) { e.printStackTrace(); return null; } }