• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q from Hanu's mock test

 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Question ID :1021101705605
4) Which of the following is NOT true about custom tags?
a)A custom tag can access JavaBeans declared in the session scope
b)A custom tag can access implicit objects of the JSP page in which it occurs
c)A custom tag can access all the user-defined objects in all the scopes
d)A custom tag can access all the custom tags declared in the same page
e)A custom tag can access all the custom tags in which it is nested
Answer is d) but how come is c) true ??
I thought unless the user-defined object is put into one of the "scope object", you can't access it from custom tag since custom tag uses PageContext to do that.
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On second thoughts,how come a) is true also?
 
Srinivas M
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. setPageContext() method is the first method that is called in the Custom Tag life cycle
2. pageContext implicit object is set on the above method call by the JSP Container. .
3. We can access other implicit objects like session, application and request using the pageContext object
So,all the object that are stored in different scopes are available to the Cutom Tags
Answer "c" is true as it clearly says that user-defined objects in all scopes - means the user defined objected stored in different scopes.
Java Beans are the objects that are stored in one of the scopes in a JSP page( page, session, request or application). So answer "1" is true as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic