Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Ranch Foreman
Posts: 1907
13
  • 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.
 
This is my favorite show. And this is my favorite tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic