request.getAttribute( "result");和request.setAttribute("result",username);
2015-09-30 17:20
561 查看
request.setAttribute("result",username);
在request对象中加入名为result的属性并附值为username,因为request对象是可以更改的,你可以
在同一个请求中象这样访问这个属性。
虽然类似session,但与session是有所区别的,request.setAttribute设置的属性只能在当前
request只使用,比如你在Action中设置result属性,需要到jsp页面中读取:
request.setAttribute("result",username);
requests.getRequestDispatcher("result.jsp").forward(request, response);
jsp页面获取该值:
request.getAttribute( "result");
因为一同将当前action的request与response对象都发送过来,相当于直接操作自身页面。
request.setAttribute("result",username);
request.getRequestDispatcher("result.jsp").forward(request,response);
requset.getAttribute("result");
在request对象中加入名为result的属性并附值为username,因为request对象是可以更改的,你可以
在同一个请求中象这样访问这个属性。
虽然类似session,但与session是有所区别的,request.setAttribute设置的属性只能在当前
request只使用,比如你在Action中设置result属性,需要到jsp页面中读取:
request.setAttribute("result",username);
requests.getRequestDispatcher("result.jsp").forward(request, response);
jsp页面获取该值:
request.getAttribute( "result");
因为一同将当前action的request与response对象都发送过来,相当于直接操作自身页面。
request.setAttribute("result",username);
request.getRequestDispatcher("result.jsp").forward(request,response);
requset.getAttribute("result");
相关文章推荐
- NSData与UIImage之间的转换
- 《SICP》读书笔记--Chapter 2 Building Abstraction with Data
- CSU 1515 - Sequence (莫队)
- SpriteBuilder物理对象的父子关系
- SpriteBuilder物理对象的父子关系
- SpriteBuilder物理对象的父子关系
- UGUI 代码 动态添加 Event Trigger 的事件
- 利用StoryBoard修改placeholder颜色(UITextField的placeholder)
- Google Guice 依赖注入框架:简明教程
- poj2299:Ultra-QuickSort
- Parse query on pointer column
- UITableView使用selectRowAtIndexPath不能默认选中cell的问题
- UICollectionViewController 版本新特性
- 安装VMM 2012 R2累积更新1可能遇到的问题
- IOS开发-CALayer和UIView详细汇总
- c笔记05---逻辑表达式,break,continue 区别
- 《SICP》读书笔记--Chapter 1 Building Abstraction with Procedures
- OC编程无法识别UIImage,undeclared identifier 'image'
- Callable与Futrue创建线程
- 异常处理:使用UTF-8编码Mysql仍然抛出Incorrect string value异常