返回值DataResponse
来源:互联网 发布:pptv网络电视 编辑:程序博客网 时间:2024/05/29 15:55
1、BaseResponse
public class BaseResponse{ protected boolean success = false; protected String msg; public boolean isSuccess() { return this.success; } public void setSuccess(boolean success) { this.success = success; } public String getMsg() { return this.msg; } public void setMsg(String msg) { this.msg = msg; }}
2、AddResponse
public class AddResponse extends BaseResponse{ private Object data; public Object getData() { return this.data; } public void setData(Object data) { this.data = data; }}
3、DataResponse
public class DataResponse extends BaseResponse{ private Map<String, Object> data = new HashMap(); public Map<String, Object> getData() { return this.data; } public void setData(Map<String, Object> data) { this.data = data; }}
例子:
@RequestMapping(value = "/getLimitDetails", method = {RequestMethod.GET,RequestMethod.POST})@ResponseBodypublic DataResponse getLimitDetails(Long id,Long parentId) {DataResponse response = new DataResponse();SmIaasQuotaV result = null;try {result = limitService.getLimitDetails(id,parentId);if(result != null){response.setData(BeanMapper.map(result, Map.class));response.setSuccess(true);}} catch(BusinessException e) {throw new ControllerException(HttpStatus.OK, e.getCode(), e.getMessage());} catch(Exception e) {final String msg = messageSource.getMessage(TipsConstants.QUERY_FAILURE);throw errorLogService.throwControllerException(LOGGER, HttpStatus.OK, null, msg, msg+",getLimitDetails error", e);}return response;}
前台:
$.ajax({ url: _root + "/limit/getLimitDetails?id="+node.id+"&parentId="+node.parentId, type: "GET", dataType: "json", async:false, success: function (data, textStatus, XMLHttpRequest) { if(data.success){ var model = data.data; $("#instanceLimits").val(model.instanceLimits); $("#publicIpLimits").val(model.publicIpLimits);。。。 } } });
。。
0 0
- 返回值DataResponse
- 返回值..
- 返回值
- 返回值
- 返回值
- 返回值
- 返回值
- 返回值和返回引用
- shell 返回返回值调用
- 函数返回值 返回引用
- 值返回与引用返回
- upper_bound()返回值 lower_bound()返回值
- lower_bound()返回值 & upper_bound()返回值
- webservice中返回多个返回值
- 函数返回值—返回局部变量
- 函数返回值—返回局部变量
- 返回引用和返回值的差别
- 函数返回值—返回局部变量
- 在ubuntu14.04下用自己的数据集训练faster-rcnn遇到的问题
- tree
- chmod 修改权限
- Maven命令
- java concurrentHashMap 源码解析
- 返回值DataResponse
- DozerBeanMapper + 对象转Map方法
- Python函数参数类型*、**的区别
- Spring Data JPA
- ant工具使用
- 基本文本编辑diff,cut,grep sed,awk
- Ubuntu下安装mysql及中文乱码解决
- Maven开发多模块项目
- dependencyManagementy与dependencies的区别