request 获取请求参数
2016-01-25 09:03
519 查看
/**
* 根据request获取请求的用户参数
* @return
* @return
*/
protected <T> T getParamConvertEntity(Class cls) {
Object obj = null;
try {
obj = cls.newInstance();
Map paramMap = new HashMap();
paramMap.putAll(request.getParameterMap());
//设置用户ID
paramMap.put("userId", getUserId());
BeanUtils.populate(obj, paramMap);
log.debug("请求的用户信息为:"+JSONObject.fromObject(obj).toString());
} catch (Exception ex) {
log.error("用户请求信息转换错误" + ex.getMessage(), ex);
}
return (T) obj;
}
2, 获取request参数
orderInfo 实体类
BeanUtils.populate(orderInfo, request.getParameterMap());
* 根据request获取请求的用户参数
* @return
* @return
*/
protected <T> T getParamConvertEntity(Class cls) {
Object obj = null;
try {
obj = cls.newInstance();
Map paramMap = new HashMap();
paramMap.putAll(request.getParameterMap());
//设置用户ID
paramMap.put("userId", getUserId());
BeanUtils.populate(obj, paramMap);
log.debug("请求的用户信息为:"+JSONObject.fromObject(obj).toString());
} catch (Exception ex) {
log.error("用户请求信息转换错误" + ex.getMessage(), ex);
}
return (T) obj;
}
2, 获取request参数
orderInfo 实体类
BeanUtils.populate(orderInfo, request.getParameterMap());
相关文章推荐
- Request Header在网页端和API中的区别与联系
- UICollectionViewController既有headerView又有footerView。
- 安装配置Jira和Confluence集成环境
- Mac安装mosquitto错误
- *Maximum Length Palindromic Sub-Sequence of an Array.
- UIScrollView的属性总结
- HDU-1005 Number Sequence && 51NOD-1126 求递推序列的第N项
- hdoj5501GT and sequence
- DB2创建/修改SEQUENCE
- UIViewController生命周期及方法调用顺序
- UITabelView的分割线处理及介绍
- 设置UITablView的头部试图高度之后···
- 关于UIViewController self.title在IOS7中默认是黑色且字体稍小的解决办法
- 调用EasyUI控件实现下拉框选值切换DataGrid中的记录
- EasyUI 扩展自定义EasyUI校验规则 验证规则(常用的)
- UITableView 介绍
- leetcode300---Longest Increasing Subsequence(最长递增子序列)
- [SGU 532]Building Foundation[几何]
- UISearchController VS UISearchBar and UISearchDisplayController
- zImage与uImage