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 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" Watch "beanName" New topic


Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299

You want to use a bean that is stored in com/enthu/GUI.ser file. Which of following statements correctly defines the tag that accesses the bean?


Select 1 correct option.

1 <jsp:useBean id="pref" name="com/enthu/GUI.ser" />

2 <jsp:useBean id="pref" name="com.enthu.GUI" />

3 <jsp:useBean id="pref" type="com/enthu/GUI.ser" />

4 <jsp:useBean id="pref" beanName="com.enthu.GUI" type="com.enthu.GUI"/>

5 <jsp:useBean id="pref" class="com.enthu.GUI.ser" />

The answer is 4. I have no idea about the question. Please can somebody explain it.

Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
Mohd Fuzail
Ranch Hand

Joined: Feb 20, 2002
Posts: 107
bean that is stored in com/enthu/GUI.ser file

Here the package structure is provided. so the fully qualified name for this class will be com.enthu.GUI

Not sure about this .ser extension

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

Being defeated is often a temporary condition. Giving up is what makes it permanent.
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Thank you Fuzail. It really helped me. Can someone has an idea about the ".ser" extention.
I agree. Here's the link:
subject: beanName
It's not a secret anymore!