What is the difference between class
attribute and beanName
attribute of jsp:useBean
tag.
Just read the <jsp:useBean>
documentation (page 35). Here's an extract of relevance:
class="package.class" type="package.class"
Instantiates a bean from the class named in
class
and assigns the bean the data type you specify intype
. The value oftype
can be the same asclass
, a superclass ofclass
, or an interface implemented byclass
.The class you specify in
class
must not be abstract and must have a public, no-argument constructor. The package and class names you use with bothclass
andtype
are case sensitive.
beanName="{package.class | <%= expression %>}" type="package.class"
Instantiates a bean from a class, a serialized template, or an expression that evaluates to a class or serialized template. When you use
beanName
, the bean is instantiated by thejava.beans.Beans.instantiate
method. TheBeans.instantiate
method checks whether the package and class you specify represents a class or a serialized template. If they represent a serialized template,Beans.instantiate
reads the serialized form (which has a name likepackage.class.ser
) using a class loader.The value of
type
can be the same asbeanName
, a superclass ofbeanName
, or an interface implemented bybeanName
. The package and class names you use with bothbeanName
andtype
are case sensitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With