• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mistake in assesment exam?

 
JohnWilliam Fitz
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • 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
 
Zulfikar Dharmawan
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • 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.'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic