getattribute,applicationgetAttribute

伏羲号

getattribute,applicationgetAttribute?

application是jsp内置对象,从application中拿msgList,然后赋给前面的msgList变量。

getattribute,applicationgetAttribute

因为getAttribute返回object,所以需要转型成List

总是不能理解getAttribute?

JSP 的3个内置对象request,session,application,其实都有一个作用域,这些对象内部有一个Map成员用于存放数据,比如session对象的setAttribute(key,value)就是将value存入session的作用域,getAttribute(key)则是取出作用域中相应的值。

三者的差别在于request在一次请求后清空map,session在一次会话结束后清空map,application则在服务器重启后清空map,因此可以根据作用域的不同,来控制对象的生命周期。

getattribute使用方法?

通过元素节点的属性名称获取属性的值。

语法:

elementNode.getAttribute(name)

说明:

1. elementNode:使用getElementById()、getElementsByTagName()等方法,获取到的元素节点。

2. name:要想查询的元素节点的属性名字

以上就是getattribute使用方法。

发表评论

快捷回复: 表情:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog
评论列表 (暂无评论,105人围观)

还没有评论,来说两句吧...