java中request的getParameter方法和getAttribute方法的用法区别比较
来源:互联网 发布:树状结构软件 编辑:程序博客网 时间:2024/06/01 17:45
java中request的getParameter方法和getAttribute方法的用法区别比较
1.request的getparameter方法的作用是获取到客户端通过表单或url请求参数所发送过来的参数值,是客户端与服务器端之间的交互,服务器端想获取到客户端发送过来的数据,就需要使用getparameter方法来获取,没有与getparameter方法对应的setparameter方法。
2.request的setAttribute与getAttribute方法一般都是成对出现的,首先通过setAttribute方法设置属性与属性值,然后通过getAttribute方法根据属性获取到与该属性对应的对象值(获取到之后一般都需要进行向下类型转换,将属性值转换为真正的对象)。setAttribute与getAttribute方法都是在服务器端内部执行的,客户端不知道服务器端是否执行过这两个方法。
总结:只要记住以下一句话即可
getParameter方法就是服务器端接受客户端传递过来的数据时使用;
getAttribute方法是在服务器端内部使用,数据通过getParameter获取进来之后,在另一个页面还想继续使用这个数据就要把这个数据通过setAttribute保存起来,想用时再用getAttribute取出来即可使用!(同样也可以用session.setAttribute和session.getAttribute方法来进行数据的保存和使用!)
阅读全文
0 0
- java中request的getParameter方法和getAttribute方法的用法区别比较
- request.getattribute和getparameter方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter()和getAttribute()方法的区别
- Request的getParameter()和getAttribute()方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- Request的getParameter和getAttribute方法的区别
- 修改caffe源代码--添加loss(层)函数--GPU
- 事务补偿型TCC事务
- 背包问题 2 完全背包解题报告
- 蒙特卡洛算法
- BZOJ 2120 数颜色
- java中request的getParameter方法和getAttribute方法的用法区别比较
- C++中函数调用时的三种参数传递方式详解
- 【C++】获取当前文件夹内的所有文件
- 【CUGBACM15级BC第五场 A】hdu 4956 Poor Hanamichi
- hdu6121(想法题目)
- JavaScript之DOM管理常见错误:
- js字符串
- poj 1094
- T(n) = 25T(n/5)+n^2的时间复杂度