springmvc 怎么把jsonobject类型数据返回 页面

2024-11-30 17:37:21
推荐回答(1个)
回答1:

@RequestMapping(value = "/signin", method = RequestMethod.POST)
@ResponseBody
public String signin(String code, String password, ModelMap model){
String message = "";
User user = new User();
if(!code.equalsIgnoreCase("000001"))
message = "code:帐号不存在";

else if(!password.equalsIgnoreCase("123"))
message = "password:密码错误";

else{
model.addAttribute(Constants.SESSION_USER, user);
message = "redirect:index.html";
}
return message;
}