java里面的getAttribute和findAttribute的區別


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。 

 

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。 

 


兩種的區別是,查找范圍不同


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM