import java.lang.reflect.InvocationTargetException;
import javax.servlet.http.HttpServletRequest;
import com.sun.org.apache.commons.beanutils.BeanUtils;
public class WebUtil {
public static <T>T fillBean(HttpServletRequest request, Class<T> clazz)
{
try {
T t = clazz.newInstance();
BeanUtils.populate(t, request.getParameterMap());
return t;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
BeanUtil的应用填充数据
最新推荐文章于 2023-12-11 22:27:12 发布