aspose file tools*
The moose likes JSP and the fly likes jsp:useBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:useBean" Watch "jsp:useBean" New topic
Author

jsp:useBean

geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
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

Joined: Sep 16, 2004
Posts: 3636
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 ]

My blood is tested +ve for Java.
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
so,
the beanName is similar to the 'class' is it? In that case, why an additional attribute... class and beanName???
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
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

Joined: Sep 16, 2004
Posts: 3636
<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

Joined: Jun 07, 2005
Posts: 118
Thanks a ton Chetan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:useBean