Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EPractice Lab mock exam 4 <jsp:useBean> execution order  RSS feed

 
Ranch Hand
Posts: 1684
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


To locate or instantiate the bean <jsp:useBean> takes the following steps in this order:
Given answer:
1. if it finds the bean, stores a reference to it in the variable.
2. if it does not find the bean , instantiate it from the class you specify storing a reference to it in the new variable.
3. Attempts to locate a bean with the scope and name.
4. Defines an object reference variable with the name.

Explanation:
The <jsp:useBean> element locates or instantiates a JavaBeans component. <jsp:useBean>
first attempts to locate an instance of the bean. If the bean does not exist, <jsp:useBean> instantiates it from
a class or serialized template.
To locate or instantiate a bean, <jsp:useBean> takes the following steps in this order:
1. attempts to locate a bean with the scope and name you specify.
2. defines an object reference variable with the name you specify.
3. if it finds the bean, stores a reference to it in the variable. if you specified type, gives the bean that type.
4. if it does not find the bean, instantiate it from the class you specify, storing reference to it in the new variable. If the
class name represents a serialized template, the bean instantiated by java.beans.Benas.instantiate.
5. if <jsp:useBean> has instantiated (rather than located) the bean, and if it has body tags or elements (between <jsp:useBean>
and </jsp:useBean>, execute the body tags.



The given answer and the explanation is different. I believe the explanation is correct.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!