Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

useBean - type & class

 
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
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!