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
classand assigns the bean the data type you specify intype. The value oftypecan be the same asclass, a superclass ofclass, or an interface implemented byclass.The class you specify in
classmust not be abstract and must have a public, no-argument constructor. The package and class names you use with bothclassandtypeare 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.instantiatemethod. TheBeans.instantiatemethod checks whether the package and class you specify represents a class or a serialized template. If they represent a serialized template,Beans.instantiatereads the serialized form (which has a name likepackage.class.ser) using a class loader.The value of
typecan be the same asbeanName, a superclass ofbeanName, or an interface implemented bybeanName. The package and class names you use with bothbeanNameandtypeare 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