Is there any advantages of using SessionMap
over Map for a session in web application ?
1 advantage I found was you can invalidate a SessionMap
but not Map
.
Is there any advantages of using SessionMap
over Map for a session in web application ?
1 advantage I found was you can invalidate a SessionMap
but not Map
.
The SessionMap
is specifically designed for the purposes if you want to have access to the servlet session attributes. So, the user is able to keep a synchronized collection of objects in session and use it instead of HttpSession
directly. This object is automatically injected by the servletConfig
interceptor which is a part of the defaultStack
if you implement SessionAware
interface in the action class. As soon as you don't need to work with servlet session directly and don't have access to it you can at least invalidate a session that finalizes the collection of objects in it. A new session map required to action context if you want to continue to use a session.