使用场景:前端 需要判断是否撤回(修改)成功 成功返回1,失败返回2
//成功返回 1
//失败返回 2
@RequestMapping("EmpId")
@ResponseBody
public Map EmpId(HttpServletRequest request) {
Map map = new HashMap();
try {
map.put("code", "1");
} catch (Exception e) {
map.put("code", "2");
map.put("未知错误");
}
return map;
}
map还可以存放 true和false 成功返回true 失败返回false
使用场景: 前端 需要判断 true和 false
//成功返回true 失败返回false
@RequestMapping("EmpId")
@ResponseBody
public Map EmpId(HttpServletRequest request) {
Map map=new HashMap();
map.put("Flag","true");
try{
//里面是判断 true和false
}catch (Exception e){
map.put("Flag","false");
}
Integer 可以存放数字
使用场景:前端需要根据 后端传过来的 数字,判断是哪一个类型
用法:
@RequestMapping("/www")
@ResponseBody
public Integer www(HttpServletRequest request) {
Integer a=0;
if(!"1".equals(qq.getqqType())){
a=1;
}
if(!"1".equals(qq.getqqType())){
a=2;
}
return a;//最后给前端返回要给 数字
}



