File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes beanName attribute in jsp:usebean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "beanName attribute in jsp:usebean" Watch "beanName attribute in jsp:usebean" New topic

beanName attribute in jsp:usebean

Eshu San

Joined: Sep 30, 2004
Posts: 18
I have never seen in the HFS&JSp where the author has mentioned the use of the attribute "beanName" in the jsp:usebean stsndard action.But i see questions on the mock exams on this.
Can anyone explain what is "beanName" attribute in jsp:usebean and is there any reason why the authors of HFS&JSP not mentioned abt it anywhere in the book.
vishwa venkat
Ranch Hand

Joined: Nov 22, 2003
Posts: 185
Refer JSP Syntax at

(Copied from above link)

beanName="{package.class | <%= expression %>}" type="package.class"
Instantiates a Bean from either a class or a serialized template, using the java.beans.Beans.instantiate method, and gives the Bean the type specified in type. The Beans.instantiate method checks whether a name represents a class or a serialized template. If the Bean is serialized, Beans.instantiate reads the serialized form (with a name like package.class.ser) using a class loader. For more information, see the JavaBeans API Specification.

The value of beanName is either a package and class name or an Expression that evaluates to a package and class name, and is passed to Beans.instantiate. The value of type can be the same as beanName, a superclass of beanName, or an interface implemented by beanName.

The package and class names you use with both beanName and type are case sensitive.
Kosala W.Abayagunawardene
Ranch Hand

Joined: Dec 15, 2007
Posts: 47


[SCJP] ::[SCWCD]::[BCS::BIT::SCBCD] - Studying[My Blog]
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Can you please elaborate a bit that how the combination of class and type is different from the combination of bean name and type. which one is better and on which type of situations?

The combinations which I am referring to are as mentioned below - Combination of beanname and type

Combination of class and type -

Salil Verma

Salil Verma
I agree. Here's the link:
subject: beanName attribute in jsp:usebean
jQuery in Action, 3rd edition