SessionMap vs Map哪个更适合Session? [英] SessionMap vs Map which is better for Session?
问题描述
1优点我有什么优势在网络应用程序中使用地图上的 SessionMap
发现你可以使 SessionMap
而不是映射
。
如果您想要访问servlet会话属性, c HttpSession
。如果实现 servletConfig
拦截器自动注入,该拦截器是 defaultStack
的一部分> SessionAware 界面。一旦您不需要直接使用servlet会话,并且无法访问它,您至少可以使完成其中对象集合的会话无效。如果要继续使用会话,则需要使用动作上下文的新会话映射。
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.
这篇关于SessionMap vs Map哪个更适合Session?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!