java - Retrieving Session Attributes after Session Times Out -
i have spring mvc project setup define several model attributes & session attributes when user accesses home page home.html
.
homecontroller.java
@requestmapping(value = "/gethomepage", produces = "text/html", method = requestmethod.get) protected modelandview gethomepage(httpsession session) { modelandview mav = new modelandview("home"); // stuff session.setattribute("attr1", "cool"); session.setattribute("attr2", "attributes"); return mav; }
i grab these session attributes on separate orderform.html
(i'm using thymeleaf template engine)
session attribute 1: <div th:text="${session.attr1}"></div> session attribute 2: <div th:text="${session.attr2}"></div>
this works fine until session timed out/invalidated , user still on orderform.html
- lose scope of session attributes they're defined on home @controller
can retrieve session attributes without first hitting homepage , without setting them on every view @controller
in project?
Comments
Post a Comment