52,797
社区成员
发帖
与我相关
我的任务
分享
$.ajax({
url:"http://localhost:8080/hon/LoginServlet?method=doLogin",
type:"post",
data:{"username":username,"password":password,"code":code},
async: true,
beforeSend:function(){
$("#login").val("登陆中");
},
success:function(msg){
if(msg=="true"){
$("#username").val("");
$("#password").val("");
alert("账号或密码有误,请重新输入");
$("#login").val("登录");
}else{
window.location.href="main.jsp";
}
}
});
UserService us = new UserServiceImpl();
if(!code.equals(rcode)) {
out.println("false");
return;
}
if(us.login(username, password)) {
req.setAttribute("username", username);
out.println("true");
}else {
out.println("false");
}
out.flush();
out.close();