web中的Parameter和Attribute区别

来源:互联网 发布:允许淘宝访问麦克风 编辑:程序博客网 时间:2024/06/05 09:54
getAttribute是取得jsp中 用setAttribute設定的attribute 
parameter得到的是string类型数据;attribute得到的是任意类型的数据 

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

注:Parameter为客户端到服务器端的String类型数据传输,Attribute为web容器之间的任意类型数据传输

0 0
原创粉丝点击