• Post Reply Bookmark Topic Watch Topic
  • New Topic

useBean - type & class  RSS feed

 
Bess Moore
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have
- class employee
- interface person

As I understand that I can use

<jsp:useBean id="emp" type="test.person" class ="test.employee" scope="session" />

But I don't understand in what circumstances that I would need both class and type together.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I don't understand in what circumstances that I would need both class and type together

If you want to use polymorphic behaviour
<jsp:useBean id="emp" type="test.person" class ="test.employee" scope="session" />

This will create the Employee object and will store it in Person, if the emp object is already not in session scope.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!