• Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt about jsp:useBean

 
Victor Maehira
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning!
I was solving a mock, when I faced the following question:

A JSP page needs to instantiate a JavaBean to be used by only that page. Which two jsp:useBean attributes must be used to access this attribute in the JSP page? (Choose two)
A. id
B. type
C. name
D. class
E. scope
F. create

The answer is B! It is incorrect, firstly, because the question says "choose two"! Moreover, I believe the correct answer should be A and D.
The id and the class is enough to access the bean ONLY in that page. What do you think?
Thanks!
 
Ezhil S Alagesan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, your options seems to be correct. :roll:

'id' is a mandatory field.

Then 'class' and 'type' comes into picture.

Out of them 'type' cannot be used to instantiate a bean.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, and without the scope it wil ldefault to the page
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!