• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

mistake in assesment exam?

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

The following question is from an scwcd assesment exam of a very large company we all know. I won't say who...

:::beginning of question::::
Given a JSP page with the line:

<jsp:useBean id="cust" type="test.beans.CustomerBean" scope="session" />

Which two occur? (Choose two.)
A> A CustomerBean instance is created if the attribute name cust is not found.
B> The session is searched for a CustomerBean stored as the attribute name cust.
C> The CustomerBean instance is populated with the values of the parameters in the request.
D> A CustomerBean instance is always created and stored in the session with the attribute name cust.
E> The CustomerBean identified by cust is located in the application and then stored in the session for later use.
::::end of question:::::

The answer they give is A and B. But I do not believe it is correct. I have tried to duplicate the behaviour myself and what I have found is if <jsp:useBean> includes the "type" attribute, and not the class attribute, a missing bean instance is NEVER created.

So I believe that only B is true.

Who is wrong? Me? Or this big company who I will not name?

Thanks!
John
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I agree with you. I've tried that myself, it doesn't create a new bean.
There is also an excerpt from HFSJ:
'If type is used without class, the bean must already exist.
If class is used (with or without type) the class must NOT be abstract, and must have a public no-arg constructor.'
 
reply
    Bookmark Topic Watch Topic
  • New Topic