No, beanName is not equivalent to class. beanName specify the name of a bean (a REAL javaBean) as you would use in a instantiate() method of Java Beans. This attribute MUST go along with the type attribute, defining the object type. So, the only way to use beanName is like this :
In answer 1,beanName did'nt follow java naming rule.So how come it is correct?
my concusion is,
The beanName attribute can refer to a class name or the name of a serialized file containing the bean.We can either use beanName or class , it means the same but in addition beanName can also refer to a serialized bean file name.The beanName and class attributes cannot be used together.
Request anyone to clarify...
Joined: Feb 13, 2006
Sorry i forgot about the serialized file. Yes it works with a serialized bean. And beanName may ONLY be used WITH the type attribute.
From the JSP spec (JSP 5) : The attribute beanName specifies the name of a Bean, as specified in the JavaBeans specification. It is used as an argument to the instantiate method in the java.beans.Beans class. It must be of the form a.b.c, which may be either a class,or the name of a resource of the form a/b/c.ser that will be resolved in the current ClassLoader. If this is not true, a request-time exception, as indicated in the semantics of the instantiate method will be raised. The value of this attribute can be a request-time attribute expression.
From Beans API, the instantiate method description : instantiate
public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException
Instantiate a JavaBean.
Parameters: cls - the class-loader from which we should create the bean. If this is null, then the system class-loader is used. beanName - the name of the bean within the class-loader. For example "sun.beanbox.foobah"
Throws: ClassNotFoundException - if the class of a serialized object could not be found. IOException - if an I/O error occurs. [ March 14, 2006: Message edited by: Frederic Esnault ]