• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic