differences between Request Attributes and Request Parameters
来源:互联网 发布:淘宝里,宝贝详情在哪 编辑:程序博客网 时间:2024/06/05 01:06
xmike1
12-04-2004, 10:06 PM
Can someone give me a quick description of the differences between a request attribute and a request parameter? I have tried to cycle through all the parameters in a request, using getParameterNames and getParameter,in the hopes that I could modify the data and set it back to the request with setAttribute. This doesn't seem to work.
ray326
12-04-2004, 11:24 PM
A "parameter" is a form field name/value pair passed from the HTML side of the world. Its value is a String.
An "attribute" is a Java object name/value pair passed only through the internal JavaServer processes. (I.e. it can come from a JSP or servlet but not an HTML page.) Its value is an Object.
You can't alter the request parameters, just read them. If you could there would be a setParameter() method. Parameters and attributes do not share a name space so a parameter named "foo" and an attribute keyed "foo" are distinct.
An "attribute" is a Java object name/value pair passed only through the internal JavaServer processes. (I.e. it can come from a JSP or servlet but not an HTML page.) Its value is an Object.
You can't alter the request parameters, just read them. If you could there would be a setParameter() method. Parameters and attributes do not share a name space so a parameter named "foo" and an attribute keyed "foo" are distinct.
xmike1
12-05-2004, 08:53 AM
Thanks. That was very clear. So I am hosed taking this approach. I guess I would have to interogate these fields at the screen level on a submit. I could use JavaScript to go through each and change them before sending them on. More work but is sounds doable.
If there is a better approach please let me know (anyone).
If there is a better approach please let me know (anyone).
ray326
12-05-2004, 03:13 PM
If you know your users have Javascript enabled then you could certainly massage the parameters before submitting the form. A better way might be to let the servlet create an object using the parameter values then using that object as an attribute.
from:http://www.webdeveloper.com/forum/archive/index.php/t-50637.html
- differences between Request Attributes and Request Parameters
- Request Parameters and Header Values
- difference between work bench request and customizing request
- Difference between ${requestScope} and ${pageContext.request}
- Differences Between Unix and Windows
- Differences between Hibernate and NHibernate
- Differences between C++ and Java
- Differences Between innodb_data_file_path and innodb_file_per_table
- Differences between WM_NOTIFY and WM_COMMAND
- Differences between HashMap and Hashtable
- differences between ATM and Ethernet
- Differences between Datasource and XADatasource
- Differences Between Heuristics and Metaheuristics
- Differences Between PyQt4 and PyQt5
- Differences between hashmap and hashtable
- differences between Proxy and vpn
- Differences between UDID and UUID
- Differences between ArrayList and Vector
- ARP欺骗引起的网络瘫痪及处理方法
- 杀webshow木马
- VC++中进程间相互通信的十一种方法
- 广州电信呼叫中心有80年历史?
- 369678病毒的处理
- differences between Request Attributes and Request Parameters
- Context Switch Definition:上下文切换的定义
- ftp服务器
- C#基础概念二十五问
- 嵌入式linux启动信息完全注释
- Asp.net中读取web.config参数的方法
- 我最近5年要实现的目标-2007年
- NO.2
- Wiki系统搭建