• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:usebean

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the significance of using type attribute without class attribute? How does it work?
Will it check for reference type or object type or both?

Thanks,
 
Irina Goble
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A type attribute can be an abstract class or an interface. If the bean already exists you might not care what the real type it is, so it might be useful to use type without class.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing using type (without class) is significant only when the bean already exists in the given scope.
Because no new bean is created in this case.


Hope this helps .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

in type, you can use concrete class also similarly in class ,you can use abstract class also..... but bean must be exist in scope
 
Irina Goble
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When only type is specified, the generated servlet will explicitly throw an exception if the JavaBean does not exist. And it is a good thing because you might not know the real type of the bean and you don't want a new bean of "type" type created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic