• Post Reply Bookmark Topic Watch Topic
  • New Topic

HFSJ -> pageContext.findAttribute

 
Claudiu Cismaru
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About HFSJ, pg 311 - "Using the pageContext to find an attribute when you don't know the scope"

I remember the first time when I saw this function in someone's code and a vague explanation that it finds the attribute in the following order - page, request, session, application scope I was really curious to take a look in the API to figure what a heck does this function return - either the attribute (Object) or , who knows, the scope where the attribute resides - say PageContext.SESSION_SCOPE (you can use getAttibute(String, int) if you have this, right). It returns an Object, as pretty much expected ...

Now, when I read pg 311 from HFSJ I think that some others may like to get a better idea of what the function returns - still an Object, even 2y after my initial curiosity ...

(Don't know why, but I love to have the full description of arguments and return type for a function in general - that's what api docs are for, true ... )

In case others feel the same, for findAttribute that would be:
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.

Cheers,
Claudiu
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!