我从前端登录后
$(function(){
$('#login').click(function(){
var username=$('#username').val();
var password=$('#password').val();
var datas={
"username":username,
"password":password
};
$.ajax({
url:'/register.xhtml',
type:'post',
contentType:"application/x-www-form-urlencoded",
data:datas,
success:function(data){
console.log("123"+data.username);
},
error:function(data){
alert("系统出错")
}
})
})
})
跳到后端
@RequestMapping("/register.xhtml")
@ResponseBody
public List<Map<String,Object>> login(
@RequestParam("username") String username,
@RequestParam("password") String password,HttpServletRequest request){
System.out.println(username);
System.out.println(password);
UsercenterEntity usercenterEntity=new UsercenterEntity();
usercenterEntity.setUsercenterusername(username);
usercenterEntity.setPassword(password);
List<Map<String,Object>> list=baseServiceUtil.query4list(usercenterEntity);
if(list.size()>0){
System.out.println("登录成功");
request.getSession().setAttribute("usercenterusername",usercenterEntity.getUsercenterusername());
request.getSession().setAttribute("usercenterid",usercenterEntity.getUsercenterid());
System.out.println(request.getSession().getAttribute("usercenterusername"));
}else{
System.out.println("登录失败");
}
return list;
}
做了一个判断成功了就跳到主页面,现在的问题是页面在nginx中不知道怎样能跳到