ActionContext类与ServletActionContext类操作request域、session域内的属性
2016-01-22 15:30
447 查看
利用ActionContext类与ServletActionContext类操作request域、session域内的属性:
在项目中,为了高层次解耦,能用ActionContext类解决问题的话就不要用ServletContext类,实在不行再用ServletContext类。
String key = ""; Object value = null; ActionContext.getContext().put(key, value);// 相当于request.setAttribute(key,value) ActionContext.getContext().getSession().put(key, value);// 相当于session.setAttribute(key,value) ServletActionContext.getRequest().setAttribute(key, value); ServletActionContext.getRequest().getSession().setAttribute(key, value);
在项目中,为了高层次解耦,能用ActionContext类解决问题的话就不要用ServletContext类,实在不行再用ServletContext类。
相关文章推荐
- NGUI 导入,场景准备
- form表单-request得不到值为null-以及Enctype=multipart/form-data介绍
- github基础操作教程:fork,clone以及pull request
- 获取UUID的网址
- 非UI主线程如何弹出Toast以及Handler.post()流程分析
- 使用sync-request和cheerio写爬虫
- UIWindow头文件学习
- IOS中Segue的使用
- TrineaAndroidCommon API Guide
- IOS中UITableViewCell使用详解
- 解决reload AVD list: cvc-enumeration-valid: Value '360dpi' is not facet-valid with respect to enumeration '[ldpi, mdpi, tvdpi, hdpi, 280dpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]'. It must be a v
- UITableView简单使用
- UI基础学习之(十二):UINavigationController
- C# 连接 mySQL 出现 GUID 应包含带 4 个短划线的 32 位数 问题
- 不错的UIPageControl替代控件TAPageControl
- poj 3080 Blue Jeans KMP多模式匹配
- Elasticsearch之query与filter
- uiviewcontroller 状态栏 self.view起始位置
- *Unique Combination of Factors (因式分解)
- Codeforces 441 B. Valera and Fruits