tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Salgueiro ...@sibs.pt>
Subject Re: Using a Java Bean inside a declaration
Date Tue, 02 May 2000 16:57:14 GMT
Hi everyone,

  Thank you for your answer. Nevertheless, in the JSP 1.1 spec it says
that if you implement the jspDestory() method it should be called when
the page is destroyed, if I'm not mistaken (it is one of the API
contracts). 
  So I tried the following (which BTW may be very stupid but here it
goes):

  <jsp:useBean id="bdcon" class="bd.BDBean" scope="session">
  ...
  <%! public void jspDestroy() {
         bdcon.Disconnect();
      }
  %>

  Jasper complains loudly when it tries to compile the page because he
does not know what the object bdcon is.

  Can someone help me with this scope error?

Regards,

Antony MA wrote:
> 
> Hi Craig,
> 
> I read the 2.2 specification and it doesn't mention
> about the relationshop between valueUnbound and
> timeout.
> 
> quota from 2.2 spec P.36 :
> " The valueUnbound method must be called after the
> object is no longer available via the getAttribute
> method of the HttpSession interface. "
> 
> Is " no longer availabe " equals timeout() ?
> 
> Antony Ma
> 
> --- "Craig R. McClanahan"
> <Craig.McClanahan@eng.sun.com> wrote:
> > Bruno Salgueiro wrote:
> >
> > > Hi folks.
> > >
> > >   After a lot of diggin' I finally put Tomcat 3.1
> > working as needed. I
> > > only have a small question that I couldn't answer
> > reading the JSP 1.1
> > > spec but it might be a Tomcat problem...
> > >
> > >   A have declared a bean on a JSP in a session
> > context. Then, in the
> > > same
> > > page, I'm trying to define the method jspDestroy
> > in a declaration tag so
> > > that the bean closes the connection when the page
> > is destroyed. Now, I
> > > can't manage to reference the bean inside the
> > declaration...
> > >
> > >   Has someone did this? And by the way, when the
> > session dies does
> > > Tomcat
> > > calls a pre-defined method on all the beans
> > created or not?
> > >
> >
> > It does if your session bean implements the
> > HttpSessionBindingListener
> > interface -- see the servlet spec for more details.
> > <http://java.sun.com/products/servlet>.
> >
> > The usual approach is that you have your bean
> > implement this interface, and
> > then when the valueUnbound() method is called it can
> > clean up connections or
> > whatever.  The nice thing about this is that it
> > happens even when the servlet
> > container times your session out, when you
> > invalidate the session, or when the
> > server is shutting down.
> >
> > >
> > > Regards,
> > > --
> > >
> >
> =======================================================
> > > Bruno Salgueiro       (mailto:bs@sibs.pt)
> > >
> >
> > Craig McClanahan
> >
> >
> >
> >
> --------------------------------------------------------------------------
> > To unsubscribe, email:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commmands, email:
> > tomcat-user-help@jakarta.apache.org
> >
> 
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online and get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

-- 
=======================================================
Bruno Salgueiro       (mailto:bs@sibs.pt)
                   
SIBS - Sociedade Interbancária de Serviços
Rua Soeiro Pereira Gomes, Lote 1, 1600 Lisboa, Portugal

Tel: + 351 21 791 88 33
Fax: + 351 21 794 24 40
http://www.sibs.pt

Esta mensagem foi assinada com certificado MULTIcert.
Para obter o certificado da Autoridade de Certificação
PILOTO MULTIcert dirija-se ao site
            http://www.sibs.multicert.com

"Computers are useless. They can only give you answers."
                                        --Pablo Picasso
=======================================================

Mime
View raw message