HTTPSession 和 Spring
我正在使用 spring 开发一个网络应用程序。
问题是,假设我有这三个网址,
www.sample.com/login.do
www.sample.com/homePage.do
www.sample.com/about.jsp
我想要做的是 about.jsp 页面应该能够访问,即使用户是否登录。如果用户未登录并尝试访问 homePage.do,他应该被重定向到 login.do 页面,反之亦然。
我认为为此工作我需要 HTTPSessions,但我不知道如何在 Spring 中管理 HTTPSessions。
我可以使用一些过滤器来完成此操作吗?如果是这样,您能指导我完成吗?
我希望使用 Spring MVC 和/或 Spring Annotations。
I'm developing a web application using spring.
Here's the problem, say I have these three urls,
www.sample.com/login.do
www.sample.com/homePage.do
www.sample.com/about.jsp
What I want to do is about.jsp page should be able to access even if user is logged in or not. And if user is not logged in and try to access homePage.do he should be redirected to login.do page and vice versa.
I think for this to work I need HTTPSessions, but I don't know how to manage HTTPSessions in Spring.
Can I accomplish this using some filters? If so can you please guide me through it?
I'm hoping to use Spring MVC and/or Spring Annotations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Spring Security!
你的 spring 配置文件看起来有点像
Use Spring Security!
Your spring config file will be look a bit like