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
SessionMapis 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 ofHttpSessiondirectly.This object is automatically injected by the
servletConfiginterceptor which is a part of thedefaultStackif you implementSessionAwareinterface 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.