首页 期权学习期权知识正文

java中getAttribute和findAttribute的区别

xiaojiucai 期权知识 2020-08-18 501 0

getAttribute:

abstract  Object getAttribute(String name)
          Returns the object associated with the name in the page scope or null if not found.

  在page scope内查找与name相关的属性,找到返回就返回对象,找不到就返回null。 

findAttribute:

abstract  Object findAttribute(String name)
          Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.

  依次在page,request,session(如果有效的话)和application Scope(范围)查找以name为名的Attribute,找到就返回对象,都找不到返回null。 

总结:它们的区别是查找范围不同

原文链接:https://www.qiquanji.com/post/7971.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。