• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

type attribute of jsp:useBean action

 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
what is the type attribute for that action?
what i understood it is specifies the type of the object.
what is the difference between the type and class attribute?
thanks alot
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference between a class and an interface. Or a superclass.
In

if you say in the JSP that the "type" is ActionListener you can only use the methods defined in that interface.
If you don't say "type" and just class, then you can use all the methods of the class, in the object.
Also, the same applies to class/superclass relationships. You may have a subclass X but use "type" of its superclass.
I have never needed to use the "type"...
Anyone?
[This message has been edited by Tony Alicea (edited March 05, 2001).]
 
Scott Stirling
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The type attribute allows you to do a class cast on a class or beanName. Only upcasts (casts to a superclass or an interface implemented by class) are allowed.
The type attribute can be used by itself (i.e., without beanName or class) if the id attribute specifies a bean that is already instantiated. Otherwise, the type attribute must be used to do a class cast on a beanName or class specified in the same tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic