struts2 action 内 map 类型的 session 存入和提取 object 数据操作及处理
2015-12-03 13:17
555 查看
struts2 session 处理,先导入 com.opensymphony.xwork2.ActionContext 类,在 action 直接创建该对象即可处理当前连接的 session,session 为 map 类型,通过 put 和 get 对 session 进行处理。
Q群讨论:236201801
.
// action 内处理 session 需要导入的类 import com.opensymphony.xwork2.ActionContext; // 创建 ActionContext ActionContext actionContext = ActionContext.getContext(); Map<String, Object> mapSession = actionContext.getSession(); String strUsername = request.getParameter("username"); String key ...... // 向 session 内存入数据 mapSession.put("member", strUsername); mapSession.put("id", key); .... .... // 提取 session 信息 Object objMember = mapSession.get("member"); String mName = objMember.toString();
Q群讨论:236201801
.
相关文章推荐
- AES加密(兼容php,java,objective-c)
- iOS archiveRootObject 归档失败问题
- Objective-C规范注释心得——同时兼容appledoc(docset、html)与doxygen(html、pdf)的文档生成
- 使用Objective-C的文档生成工具:appledoc
- NSObject没有父类,他是怎么来的呢(一)
- DeepBox: Learning Objectness with Convolutional Networks
- SuperMap iObjects .NET开发ASP .NET网站入门
- ofbiz调用服务时报错:Service [xxxService] ran into an unexpected null object (null)
- [Rman]RMAN-06207 WARNING:2 objects could not be deleted for DISK channel(s) due
- 本人在开发过程中用到的资源
- Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with
- 对象池 object pool
- 【iOS学习笔记】Objective-C中根据函数名调用函数
- Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(二)之Introduction to Objects
- Objective-c的基本特征:
- 【Objective-C学习记录】第一天
- Clear Screen and remove objects in RStudio
- Object-C,NSURL,统一资源定位器
- Object-C,NSURL,统一资源定位器
- Object-C,NSURL,统一资源定位器