Is there any difference between the attributes class=com.myco.MyClass and the beanName=com.myco.MyClass attributes in the <jsp:useBean> tag?

Peter Mayringer

Yes, there is some difference.


instantaites a bean from a class using the new keyword, thus invoking the class' public no-arg constructor as:
new com.myco.MyClass()


When you use beanName, the bean is instantiated via the java.beans.Beans.instantiate method. This method can also instatiate serialized forms of a class which may or may not have a public no-arg constructor.