action中使用RequestResponseSession
来源:互联网 发布:我的世界mac怎么装mod 编辑:程序博客网 时间:2024/05/17 02:20
第一种方式///////////////////
Map类型:
利用ActionContext,返回Map类型//
//先获得ActionContext对象
ActionContext context=ActionContext.getContext();
Map<String,Object> session=context.getSession();
session.put("username","scott");
Map<String,Object> request=(Map)context.get("request");
Map<String,Object> app=context.getApplication();
Servlet使用类型:
ServletActionContext返回的是Servlet使用类型//
//现获得ServletActionContext.getRequest()
HttpServletRequest httpreq=ServletActionContext.getRequest();
HttpSession httpsession =httpreq.getSession();
ServletContext httpapp=ServletActionContext.getServletContext();
第二种方式///////////////////////
Map类型:
将Action实现Aware接口,由框架底层将对象注入给Action的变量
RequestAware接口:Map类型的request
SessionAware接口:Map类型的session
ApplicationAware接口:Map类型的application
http类型:
ServletRequestAwre接口:http类型的request
ServletResponseAware接口:http类型的response
ServletContextAware接口:http类型的application
- action中使用RequestResponseSession
- Action中使用getServletContext()
- Action中使用session
- struts2 action中使用AJAX
- Action中使用request、response
- Action中使用session方法
- 【struts2】action中使用通配符
- Action中使用session方法
- 【struts2】action中使用通配符
- Struts中Action动态使用
- Action中通配符的使用
- Action中使用Servlet对象
- ALM中action使用,包括多action复用
- QTP中action使用,包括多action复用(转)
- Struts action 中使用jspsmartupload 上传文件
- action中共享变量的使用
- 在Eclipse开发中使用Retarget Action
- struts2中,<s:action/>使用注意事项
- SQL查询语句精华使用简要
- 背景建模方法的系统分析
- 设计模式学习笔记——工厂
- 如何查看ASM磁盘空间使用情况
- ios开发专业术语词汇
- action中使用RequestResponseSession
- 数据和C
- Thinking in Java之对象的创建过程
- Android------looper
- IA32和x64架构分段数据结构
- hive经验
- 指针篇之六 指针与结构体,小心刻舟求剑
- 如果当初学习编程时能有人给我这些忠告该多好(挺不错的,力挺)
- C++异常中的堆栈跟踪