我的是子页面修改密码,然后修改成功后在父页面直接跳转到登录页面
但是在子页面发送请求,返回时也会返回到子页面类似于这样:
解决方案:
使用: top.location.href 进行请求使主页面跳转
首先在返回是加入一个字符作为判断
。。。。。。。。。。。。。。。。。。。
model.addAttribute("tip","1");
return "login";
}
login页面jQuery代码:
<script>
$(document).ready(function(){
var tip ='<%=request.getAttribute("tip")%>';
var message ='<%=request.getAttribute("msg")%>';
if(message!=""&&message!=null&&message!="null") {
var tip ='<%=request.getAttribute("tip")%>';
alert(message)
if(tip=="1") {
top.location.href = "logout";
}
}
})
</script>
使用 top.location.href 再次请求,返回到登陆页面