• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt in pg 565 custom tag development- question no 14

 
harinath chakrapani
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which are valid method calls on a page Context object?

its given
are correct what is the diffence?


also



what does this mean



 
Sandip Kaviman
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you see the method signature of the method your doubt will be clear.



This method takes name of the attribute as String and returns the scope in which attribute is defined.

Hope this helps.

Sandip
 
Ravi Singh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you do pagecontext.getAttribute("key") it is equivalent to pagecontext.getAttribute("key",Pagecontext.PAGE_SCOPE)
It means that an attribute bound to page scope will be found.

When you do pagecontext.findAttribute("key") an attribute is searched from page scope to application scope and which ever is found first is returned

Bottom line :

In pagecontext.getAttribute("key",Pagecontext.PAGE_SCOPE) attribute is only searched in page scope

In pagecontext.findAttribute("key") attribute is searched in all 4 scopes
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!