Forums Register Login

Bad answer in question in Sun preparation exam

+Pie Number of slices to send: Send
Hi guys,

I'm having problems with this question:


Given a JSP page with the line:

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

Which two occur?



the preparation exam gives these two valid answers:


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.



As far as I know, A cannot be true because when not using class attribute in useBean tag, if the beans is not preinstantiated, the JSP NEVER tries to instantiate one. Am I missing some thing or this is definitively wrong?

Cheers,

Iv�n
+Pie Number of slices to send: Send
You're right neither A nor B is correct
+Pie Number of slices to send: Send
From the JSP spec you can declare the type attribute on its own with <jsp:useBean> BUT the bean must exist otherwise it will throw a runtime exception so A is definitely wrong.
+Pie Number of slices to send: Send
Answer A is not correct. Ivan has give the right reason for it.

I don't agree with Mamadou that Answer B is also not correct. I think that Answer B is correct, because I don't see any reasons why this answer shouldn't be correct.
+Pie Number of slices to send: Send
Hi Folks,

Christian, You're right,

I've just re-read the answer B
B
The session is searched for a CustomerBean stored as the attribute name cust.


I missinterpreted the sentence, it's the CustomerBean which is searched and not a Session.

I apologize for the mistake
Don't play dumb with me! But you can try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 857 times.
Similar Threads
jsp:useBean type attribute problem
jsp:useBean tag question in mock exam
question of useBean
get fresh data from database using HttpSessionListener
mistake in assesment exam?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:51:56.