本机和测试服务器都能取到值,发布到正式环境上就取值为null,
js代码:
$.ajax({
url: 'login.action',
type: 'POST',
data: {
"username": L.inputAccount.val(),
"password": L.inputPassword.val()
},
dataType: 'json',
catch:true,
success: function (data) {
console.log(data);
$btn.button('reset');
if (data.result) {
//跳转地址
window.location.href = "view.action";
} else {
L.errorTip.text(data.msg).show();
}
$btn.button('reset');
},
error: function () {
L.errorTip.text('请检查网络或联系后台管理人员!').show();
$btn.button('reset');
}
})
后台代码:
@RequestMapping(value="login.action", method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> login(HttpServletRequest req){
Map<String,Object> model = new HashMap<String,Object>();
HttpSession session = req.getSession();
String username = req.getParameter("username");
String password = req.getParameter("password");
resultLog.info("登录信息"+username+"----------"+password);
Map<String,Object> employeeInfo = service.getEmployeeInfo(username,password);
if(employeeInfo != null && employeeInfo.size()>0){
model.put("result", true);
model.put("msg", "登录成功");
session.setAttribute("onlineuser", employeeInfo);
session.setAttribute("username", employeeInfo.get("Name"));
session.setAttribute("ID",employeeInfo.get("ID"));
}else{
model.put("result", false);
model.put("msg", "用户名或密码错误,请重新填写!");
}
return model;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。