public enum UserStatus { Login(100,"用户登陆"),LoginOut(101,"用户退出"),Remove(103,"用户不存在"); private Integer code;
private String value; public Integer getCode() {
return this.code;
} public String getValue() {
return this.value;
} UserStatus(Integer code, String value) {
this.code = code;
this.value = value;
} @Override
public String toString() {
return "UserStatus{" +
"code=" + code +
", value='" + value + '\'' +
'}';
}
}在controller中
@RequestMapping(value = "/selectUser",method = RequestMethod.POST)
public UserStatus selectUser(){
System.out.println(UserStatus.Login);
return UserStatus.Login;
}
打印的是UserStatus{code=100, value='用户登陆'},但是用postman跑这个接口返回却是字符串格式,现在的需求是也希望他返回跟System.out.println结果一致,postman跑的结果
private String value; public Integer getCode() {
return this.code;
} public String getValue() {
return this.value;
} UserStatus(Integer code, String value) {
this.code = code;
this.value = value;
} @Override
public String toString() {
return "UserStatus{" +
"code=" + code +
", value='" + value + '\'' +
'}';
}
}在controller中
@RequestMapping(value = "/selectUser",method = RequestMethod.POST)
public UserStatus selectUser(){
System.out.println(UserStatus.Login);
return UserStatus.Login;
}
打印的是UserStatus{code=100, value='用户登陆'},但是用postman跑这个接口返回却是字符串格式,现在的需求是也希望他返回跟System.out.println结果一致,postman跑的结果
解决方案 »
- 关于事件监听器的问题
- 谁可以帮忙做一个简单的Flex项目?有偿的哦, 有意向的朋友可以留言
- 下一周就要到新公司报到了,要求带来原公司的离职证明,可是原公司不给我开证明,怎么办呢?(我现在已经离开原来的公司了)
- 这是我自己测试Hibernate的映射关系时候发现的一个奇怪问题,问了好多自称是“高手”的朋友都没有办法。
- 正则表达式问题,帮忙看下,tks
- 为什么我装了JAVA虚拟机,页面只有一片灰色的空白,什么都没有呢 ? 高手帮我指点一下!!!
- 谁能告诉struts的mappings forward与http-url,jsp response redirect连接在原理有什么区别?
- 请教下面一小段代码
- 一个假期都没找到关于tomcat性能的的解决问题。。。
- 实体bean疑问
- HashMap线程安全疑问
- 波动图的json样式
public String selectUser(){
System.out.println(UserStatus.Login);
return UserStatus.Login.toString();
}