Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp usebean question regarding an existing value

 
Jim So
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey im preparing for SCWCD and reading HF Servlets. Im a little confused with jsp:useBean.

If you have an existing value (dont worry about scope).

Do you use the class attribute or the type attribute to retrieve the existing value? Or can you use either.

I thought these are the rules, am i correct?

1. You can use either either class or type or both class and type attributes to retrieve an existing bean object in scope provided.
Is this correct?

2. You can use class if you dont have an existing bean object in scope and need to create a new bean instance

3. You cant use type f you dont have an existing bean object in scope and need to create a new bean instance
 
vani venkat
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi jim
try examples with all the scenarios you mentioned here in your post if you have enough time.
 
Jim So
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am all good now thanks. Re-read page 356

If type is used withut class, the bean must already exist.

If class is used (with or without type) the class must not be abstract, amd must have a public no-arg constructor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic