时间:2021-07-01 10:21:17 帮助过:273人阅读
$(document).on(‘click‘,‘#login‘,function(){
let name = $("#name").val();
let password = $("#password").val();
$.ajax({
type:‘post‘,
url:‘${pageContext.request.contextPath}/adminLogin‘,
data:{‘name‘:name,‘password‘:password},
dataType:‘text‘,
success:function(result){
if (result ** "success"){
console.log("2132123123123123");
layer.msg(‘登录成功‘, {
offset: ‘15px‘
,icon: 1
,time: 1000
}, function(){
location.href = ‘${pageContext.request.contextPath}/index‘; //后台主页
});
}else if(result ** "fail"){
layer.msg(‘登录失败,请检查账号或密码是否正确.‘, {
offset: ‘15px‘
,icon: 2
,time: 1000
});
}
}
})
});
Uncaught TypeError: Cannot read property ‘toLowerCase‘ of undefined
at HTMLDocument.eval (eval at <anonymous> (eval at ExRmtSvrCd (eval at <anonymous> (pin.js:155))), <anonymous>:1:29732)
@RequestMapping("/adminLogin")
@ResponseBody
public String adminLogin(String userName,String userPassword){
Admin admin = service.queryAdmin(userName,userPassword);
System.out.println("1111111111111111111111111111111");
if (admin!=null){
return "success";
}else{
return "fail";
}
}
[org.mybatis.spring.SqlSessionUtils]-Creating a new SqlSession
[org.mybatis.spring.SqlSessionUtils]-SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@292f2501] was not registered for synchronization because synchronization is not active
[org.mybatis.spring.SqlSessionUtils]-Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@292f2501]
在对应方法上添加@Param注解即可解决
SqlSession was not registered for synchronization异常
标签:util 成功 异常 登录失败 because ext tis tsv cat