@Override public void setProperties(Object bean, HttpServletRequest request) { Enumeration<String> enu = request.getParameterNames(); while (enu.hasMoreElements()) { String name = enu.nextElement(); String value = request.getParameter(name); BeanUtil.setPropertyForcedSilent(bean, name, value); if (name.endsWith("Month")) { String dateParam = name.substring(0, name.lastIndexOf("Month")); if (request.getParameter(dateParam) != null) { continue; } Class<?> propertyTypeClass = BeanUtil.getPropertyType(bean, dateParam); if ((propertyTypeClass == null) || !propertyTypeClass.equals(Date.class)) { continue; } Date date = getDate(dateParam, request); if (date != null) { BeanUtil.setPropertyForcedSilent(bean, dateParam, date); } } } }
@Override public Class<?> getObjectTypeSilent(Object bean, String param, Class<?> defaultValue) { Class<?> beanType = null; if (bean != null) { try { beanType = BeanUtil.getPropertyType(bean, param); } catch (Exception e) { } } if (beanType == null) { return defaultValue; } else { return beanType; } }