This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

beanName  RSS feed

 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem

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?


Options

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.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Fuzail. It really helped me. Can someone has an idea about the ".ser" extention.
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!