onlyliuxin / coding2017

218 stars 643 forks source link

Spring mvc 做登录失效 跳转登录页面 #529

Closed haoyoulove closed 7 years ago

haoyoulove commented 7 years ago

有这么一个问题,页面上保存的登录失效,如果用户直接访问http://xxx/main.html类似的主页,我希望跳转到http://xxx/login.html这个页面。以前做过jsp是使用shiro框架来跳转的.但是现在不考虑jsp.就是html页面。 如果使用拦截器拦截的话。我测试过拦截到html。但是我返回视图的时候也是返回html后缀的视图。这会导致死循环请求。所以想问问各位同学有什么好的方法解决?

Hipple commented 7 years ago

不直接返回视图,可以尝试在后台以json形式返回登陆信息,前台判断返回信息进行跳转