解决方法一:
@RequestMapping(value="/getphone",produces = "text/plain;charset=utf-8")
/**输入手机号码后判断手机号是否存在*/
@RequestMapping(value="/getphone",produces = "text/plain;charset=utf-8")
@ResponseBody
public String getphone(String phone,HttpSession session){
Users u=service.selectPhoneService(phone);
if(u==null){//如果为空,则需要注册
String str="请您先注册,再登录。";
session.setAttribute("str", str);
return "请您先注册,再登录。";
}
return "true";
方法二,在spring-mvc.xml中添加:
application/json;charset=UTF-8