后台代码
User loginer=this.userService.getUserByLoginNameAndPassword(user);
try {
if(loginer != null){
System.out.println("A");
return "homepage";
}else{
System.out.println("B");
return "no_this_user";
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("C");
return "ERROR";
}
前台ajax
success:function(data){
alert(data);
if(data == "homepage"){
alert("跳转");
}else if(data == "no_this_user"){
alert("用户名或密码错误");
}else{
alert("其他错误");
}
},
返回
alert