NutzCN Logo
问答 怎么防止在没有登录的情况下在地址栏输入URL直接跳转页面
发布于 2713天前 作者 祝贺 2637 次浏览 复制 上一个帖子 下一个帖子
标签:

求大神解决,我希望在没登录的状态下访问任何URL都直接跳转到登录首页 之后怎么才能在点击退出之后清空数据 我现在退出了清空session 但是点击网页的后退还是能返回到我退出之前的状态

19 回复

那是浏览器缓存吧?

你指的清空是服务器的session清空了吧?

对对对 但是cookie还要清空么?

而且现在我把页面所有缓存都清空了

关键是,按后退的时候,服务器是否收到请求?

我现在想先弄一下验证的问题 现在我在没有登录的情况下 输入URL 就只能接访问页面 这样的操作太大的BUG

能收到请求 因为页面都已经跳转了 后台代码我写的是:
//退出系统
@At("/tuichuxitong")
public void tuichuxitong(HttpSession session,HttpServletResponse response) throws IOException{
System.err.println("进入结束方法===================");
session.invalidate();
response.sendRedirect("index");
}

之后我在页面点击退出的时候还是能回到退出之前的状态

我说的是,按退出之后,再按后退,返回到之前页面的时候,浏览器是否发请求了?返回之前页面的过程中,服务器是否收到请求了?

这个我真不太清楚

按理来说 太应该接收到请求的 但是服务器这边我有点懵

看后台日志

127.0.0.1 - - [20/Jul/2017:09:52:12 +0800] "GET / HTTP/1.1" 200 11452
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:53:22 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:53:23 +0800] "GET /wg/eq/codesss HTTP/1.1" 200 6216
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:53:23 +0800] "GET /wg/css/reset.css HTTP/1.1" 304 -
127.0.0.1 - - [20/Jul/2017:09:55:43 +0800] "GET / HTTP/1.1" 200 11452
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:55:55 +0800] "GET /wg/eq/codesss HTTP/1.1" 200 6216
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:59:12 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:59:12 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:59:12 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:59:12 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:09:59:12 +0800] "GET /wg/eq/codesss HTTP/1.1" 200 6216
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:28 +0800] "GET /wg/eq/adminlogin HTTP/1.1" 200 869
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:28 +0800] "GET /wg/css/styles.css HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:28 +0800] "GET /wg/images/eq/qingcai.png HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:31 +0800] "POST /wg/eq/adlogin HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:31 +0800] "GET /wg/eq/admin1 HTTP/1.1" 200 770
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:31 +0800] "GET /wg/css/styleadd.css HTTP/1.1" 304 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/tuichuxitong HTTP/1.1" 302 - //这是点击退出系统
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:00:40 +0800] "GET /wg/eq/codesss HTTP/1.1" 200 6216
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:01:42 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:01:42 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:01:42 +0800] "GET /wg/eq/codesss HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:01:42 +0800] "GET /wg/eq/index HTTP/1.1" 302 -
0:0:0:0:0:0:0:1 - - [20/Jul/2017:10:01:42 +0800] "GET /wg/eq/codesss HTTP/1.1" 200 6216

这是啥日志?nginx?

这是tomcat后台日志

话说,你的入口方法没校验登录状态的?

检验了啊 在数据库判断有没有这个用户 如果有就登录 没有就返回登录页面

?不是判断session是否已经登录??

添加回复
请先登陆
回到顶部