今天在写项目时遇到如下错误
js代码如下,layui弹出层没有弹出,控制台也得不到输出 $(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)
一直以为是我js的问题,又在代码中打印发现错误
@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
查看更多关于SqlSession was not registered for synchronization异的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did117771