• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about pageContext.findAttribute("param")

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • 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
Pie
Posts: 2533
113
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic