I am using Spring Framework. Well in some part of program I store an Attribute in session like this
req.setAttribute("learnerGroup", form.getGroup(), WebRequest.SCOPE_SESSION); // save the object/String in session
Where req is of type - WebRequest.
In the other part of program I have HttpServletRequest hreq.
Questions
1) Is it right way to save Objects is session, like I did above using WebRequest ?
2) How do I retrieve the saved Object from the session using HttpServletRequest ?
Yes, that will indeed save the object in the session attribute named "learnerGroup".
using request.getSession().getAttribute("learnerGroup")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With