SessionMap vs Map哪个更适合Session? [英] SessionMap vs Map which is better for Session?

查看:182
本文介绍了SessionMap vs Map哪个更适合Session?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



1优点我有什么优势在网络应用程序中使用地图上的 SessionMap 发现你可以使 SessionMap 而不是映射

解决方案

如果您想要访问servlet会话属性, c 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆