2021年1月13日星期三

getparameter和getattribute的区别

对于getParameter:

对于getAttribute:

区别:
1、getParameter只能返回字符串,getAttribute可以返回任意类型
2、getParameter获取的是客户端比如浏览器的数据,getAttribute获取的是服务器设置的数据

同样传递数据使用getAttribute而不使用getParameter的原因:
1、getParameter只能传递字符型数据,当需要传递map,list这种类型时,不能满足需求。而attribute可以存放java任意类型的对象
2、setAttribute是应用服务器将这个对象放到该页面对应的一块内存中,当页面重定向到其它页面时,服务器会将这个对象对应的内存拷贝到另一个页面,这样这个页面就能通过getAttribute获取到值。
而getParameter只是获取通过request请求对象中的参数值









原文转载:http://www.shaoqun.com/a/508652.html

跨境电商:https://www.ikjzd.com/

trax:https://www.ikjzd.com/w/1489

gtc:https://www.ikjzd.com/w/974


对于getParameter:对于getAttribute:区别:1、getParameter只能返回字符串,getAttribute可以返回任意类型2、getParameter获取的是客户端比如浏览器的数据,getAttribute获取的是服务器设置的数据同样传递数据使用getAttribute而不使用getParameter的原因:1、getParameter只能传递字符型数据,当需要传递ma
isbn:isbn
马士基航运:马士基航运
2020年珠海旅游景点有哪些?:2020年珠海旅游景点有哪些?
青海旅游玩什么:青海旅游玩什么
长角苗女人 - :长角苗女人 -