• Post Reply Bookmark Topic Watch Topic
  • New Topic

about pageContext.findAttribute("param")

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For mock exam question 12 of Ch 10 in Head First book,

Option C is invalid because an attribute in page scope would be found before checking request scope.
C. String p = pageContext.findAttribute("param");


When I try it, it works with a type cast:
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2785
175
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it works, but it is not guarenteed to be the value of the request-scoped attribute as required by the question. If there is an attribute with the same name "param" in the page-scope it will be assigned to p instead of the request-scoped variable.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!