----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 30, 2002 7:29 AM
Subject: what is best practice...


> hi all...
> let's say from a servlet i want to call a class and method in that class
> could i have an advice about what is the best way to do it
> 
> 
> ***
> instanciate the class in the servlet init
> 
> MyClass mc = null;
> 
> public void init() throws ServletException {
>        mc = new MyClass();
> }
> 
> processRequest(HttpServletRequest request, HttpServletResponse response) {
>  ...
>  mc.doThat(whatever);
>  ...
> }
> 
> ***
> load it dynamically each time the servlet is called
> 
> processRequest(HttpServletRequest request, HttpServletResponse response) {
>  ...
>  Class c = Class.forName(MyClassName);
>  mc = (MyClass)c.newInstance();
>  mc.doThat(...);
> }
> ***
> 
> or use a utility Bean, put it in the servlet context
> and call the func when i need it
> 
> ***
> does this all make any difference
> thanks
> 
> alain
> 
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
> 
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> 
> 
> 
N�����r��zǧu隊[h�+-��ڲ�ܢf�v)ܖ�^�{ay�ʇ�鞲ƠzȠ���HDU,D�51$���b��!����܆+޲6�j˧r��j�!����ǫ�W��{^��-�٥E�(���m���j���w(��k�ۜ���z��z���׫��kz�.�Ǭ�٥,��HDU�i��i��0�[(~�(����楳��z����i


Reply via email to