码迷,mamicode.com
首页 > 其他好文 > 详细

getParameter和getAttribute的区别

时间:2017-10-08 14:08:23      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:getattr   后台   之间   get   ring   存在   web   attribute   nbsp   

1.getAttribute 是取得jsp中 用setAttribute 设定的attribute

2.parameter得到的是String;attribute得到的是object

3.request.getParameter()方法传递的数据,会从Web客户端传到Web服务器端,代表HTTP请求数据;request.setAttribute()和getAttribute()方法传递的数据只会存在于Web容器内部,在具有转发关系的Web组件之间共享。即getAttribute()方法返回request范围内存在的对象,而getParameter()方法是获取http提交过来的数据。

 

总结:

getattribute一般用于前台获取后台转发值

getparameter一般用于后台获取前台请求值

getParameter和getAttribute的区别

标签:getattr   后台   之间   get   ring   存在   web   attribute   nbsp   

原文地址:http://www.cnblogs.com/zcjzcjzcj/p/7637122.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!