• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean

 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this valid???

<jsp:useBean id="softDrink" beanName="Drink.ser" type="com.baboon.interface.Drink" />

have never seen something like this before.
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by geetu lalchandani:
is this valid???

<jsp:useBean id="softDrink" beanName="Drink.ser" type="com.baboon.interface.Drink" />

have never seen something like this before.



Ya it is perfectly valid. You might be confused by beanName="Drink.ser" - it indicates that look Drink.ser file and desterilize object from it.


**************
beanName="{package.class | <%= expression %>}" type="package.class"

Instantiates a bean from a class, a serialized template, or an expression that evaluates to a class or serialized template. When you use beanName, the bean is instantiated by the java.beans.Beans.instantiate method. The Beans.instantiate method checks whether the package and class you specify represents a class or a serialized template. If they represent a serialized template, Beans.instantiate reads the serialized form (which has a name like package.class.ser) using a class loader.

source
**************
[ September 14, 2006: Message edited by: Chetan Parekh ]
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so,
the beanName is similar to the 'class' is it? In that case, why an additional attribute... class and beanName???
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry..

i did read this.. but need a little more information on this..
Ya it is perfectly valid. You might be confused by [i]beanName="Drink.ser"/i] - it indicates that look Drink.ser file and desterilize object from it.


Yes, was confused by the beanName. So what beanName provides is to serialize/de-serailize the file referred to in here and create a object of the type specified by 'type'.

Is that correct?
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:useBean id="softDrink" beanName="Drink.ser" type="com.baboon.interface.Drink">
Means....

com.baboon.interface.Drink softDrink = new ObjectCreatedFrom-Drink.ser-File.

<jsp:useBean id="softDrink" beanName="Drink" type="com.baboon.interface.Drink">
Means....

com.baboon.interface.Drink softDrink = new Drink();
[ September 14, 2006: Message edited by: Chetan Parekh ]
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton Chetan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic