0
A
回答
-1
用户Spring HandlerInterceptorAdapter拦截请求并检查用户会话。 如果会话对象为空/过期,则重定向到索引页面。
例子:
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
User user = (User) request.getSession().getAttribute("user");
if(!(user == null) {
response.sendRedirect("index.html");
}
}
相关问题
- 1. 春季MVC处理会话?
- 2. 春季帮助捕捉会话超时
- 3. JSF春季安全会话超时viewExpiredException
- 4. 在ASP.NET MVC中处理会话超时
- 5. 在春季会话超时前警告用户mvc
- 6. 理想春季会议超时配置
- 7. 春季会话bean管理
- 8. 处理magento会话超时
- 9. 处理会话超时?
- 10. JSF,会话超时处理
- 11. 会话超时处理
- 12. 春季MVC会话属性访问
- 13. 春季MVC中的Http会话
- 14. 会话管理不春季安全
- 15. mvc会话超时
- 16. 春季安全与自定义会话超时
- 17. 上除了超时春季安全删除会话cookie注销
- 18. 如何在春季acegi框架中配置会话超时?
- 19. 春季安全:会话处理在应用程序启动
- 20. 春季会话处理:HttpSessionDestroyedEvent没有收到
- 21. 春季会话销毁事件区分会话超时和注销
- 22. 春季SessionRegistry会话ID
- 23. 春季会话并发
- 24. 春季websocket会话开始时间
- 25. 处理发布者确认超时在春季AMQP-RabbitMQ
- 26. 处理会话超时丢失数据
- 27. 客户端处理会话超时
- 28. 处理会话变量超时
- 29. JSF会话超时&异常处理
- 30. Grails:处理HTTP会话超时事件
你可以检查这个问题http://stackoverflow.com/questions/1026846/how-to-redirect-to-login-page-when-session-is-expired-in -java-web-application 在过滤器(而不是拦截器)中,如果会话是新的,则重定向到索引页 – jpprade