It is not the style that bothers me rather what is really the difference between using import and useBean, for example useBean will instantiate the object, plus you have the ability to give it a scope and we shouldn't forget the get and setProperty. 
The problem is, which is better import or useBean:
If I have an object that will be used for one page only?
If I have an object that I need unique instances from it in several pages?
If I have an object that should survive from page to page? (this is where I commonly use useBean with session scope)
I don't need yes and no answers but rather why or the pros and cons.
 
Thank you, this is one of the best mailing lists.
 
----- Original Message -----
Sent: Tuesday, February 01, 2000 12:13 PM
Subject: Re: What is the difference between Import and useBean

Hi,

SoftLiban KEYROUZ Charbel schrieb:

I am a little confused where should I use import and where should I use useBean,example: if I have a class that manipulates a string which method should I choose<jsp:useBean id="stringManipulator" scope="session" class="myutils.string.StringManipulator" />stringMainpulator.reverseString(astring);OR<%@ page import="myutils.string.StringManipulator" %>StringManipulator sm = new StringManipulator();sm.reverseString(astring);or if reverseString was a static method I would direclty writeStringManipulator.reverseString(astring);So where should I use which style?


I can confuse you a little but more, you even can write:

<% myutils.string.StringManipulator sm=new myutils.string.StringManipulator();
        sm.reverseString(astring);
%>

it does all the same and the best is there is no rule how to use this. So feel free to use your own version.
--
Viele Grüße --- Best Regards

Sebastian Hoke
Multimedia Software GmbH Dresden
http://www.mms-dresden.de

Tel.: +49 (0)351 8505363
 

Falls ein Attachment an der Mail sein sollte, bitte auf Viren prüfen
http://www.virus.de

If there is an Attachment, please check for viruses
http://www.mcaffee.com
 

Reply via email to