You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Frans Thamura <ft...@yahoo.com> on 2001/06/01 05:38:08 UTC

Re: init() and destroy() in XSP

Ya, one of cocoon problem is no init and destroy

----- Original Message -----
From: "Polley Christopher W" <Po...@JohnDeere.com>
To: <co...@xml.apache.org>
Sent: Friday, May 04, 2001 9:16 PM
Subject: init() and destroy() in XSP


> Hello, all:
>
> I have an XSP page in which  I would like to do some setup (open JDBC
> connection, create prepared statements) upon instantiation and cleanup
> (close ps's and connection) upon destruction.
>
> In its previous life as a jsp page, it used jspInit() and jspDestroy(),
and
> in a servlet it could use init() and destroy().
>
> I found XSPPage.init(parameters), which I can override to do the
> initialization, but I am unclear on the tail end of the xsp life cycle.
How
> & when is it destroyed (in Cocoon 1.8.1) ?  How is this type of thing done
> in XSP?
>
> I suppose that in this case, in which I am only doing JDBC stuff, I could
> try the sql taglib, but am unclear on how that would be done.  Can
> <?cocoon-process type="sql"?> safely be placed ahead of <?cocoon-process
> type="xsp"?>? What would the resultant xsp-servlet look like?
>
>
> Thanks,
> Chris
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Cocoon and threads

Posted by Antonio Parolini <to...@employer.com.br>.
I think this beaviour was given by IE. I made the test on the same machine
using dfferente IE sessions...

Sorry about this...

The page seems now to be  synchronized...

- Tony

> -----Original Message-----
> From: Antonio Parolini [mailto:tony@employer.com.br]
> Sent: sexta-feira, 1 de junho de 2001 14:22
> To: cocoon-users@xml.apache.org
> Subject: Cocoon and threads
>
>
>
> Hi there,
>
> Let's think about the following XSP page accessed by two users in the same
> time:
>
> <page>
> 	<xsp:logic>
> 	String sName = session.getAttribute("name") ;
> 	[...]
> 	</xsp:logic>
>
> 	Welcome <xsp:expr>sName</xsp:expr>
> </page>
>
> In concurency tests I made, sometimes, users don't see their own
> name on the
> browser!
>
> One could put all the xsp page logic into a synchronize(this){ [..] }
> block...
>
> But I was wondering if someone already ran into this problem and
> what is the
> reason why XSP pages aren't already declared as synchronized...
>
> Any clues ?
>
> - tony
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon and threads

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 1 Jun 2001, Antonio Parolini wrote:

>
> Hi there,
>
> Let's think about the following XSP page accessed by two users in the same
> time:
>
> <page>
> 	<xsp:logic>
> 	String sName = session.getAttribute("name") ;
> 	[...]
> 	</xsp:logic>
>
> 	Welcome <xsp:expr>sName</xsp:expr>
> </page>
>
> In concurency tests I made, sometimes, users don't see their own name on the
> browser!
>
> One could put all the xsp page logic into a synchronize(this){ [..] }
> block...
>
> But I was wondering if someone already ran into this problem and what is the
> reason why XSP pages aren't already declared as synchronized...

they don't need to be, as long as you restrict yourself to method
variables and not class variables. i can't tell why your example wouldn't
work perfectly - maybe if you'd post your entire xsp page...?

- donald


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Cocoon and threads

Posted by Antonio Parolini <to...@employer.com.br>.
Hi there,

Let's think about the following XSP page accessed by two users in the same
time:

<page>
	<xsp:logic>
	String sName = session.getAttribute("name") ;
	[...]
	</xsp:logic>

	Welcome <xsp:expr>sName</xsp:expr>
</page>

In concurency tests I made, sometimes, users don't see their own name on the
browser!

One could put all the xsp page logic into a synchronize(this){ [..] }
block...

But I was wondering if someone already ran into this problem and what is the
reason why XSP pages aren't already declared as synchronized...

Any clues ?

- tony


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: init() and destroy() in XSP

Posted by Matthew Cordes <co...@cs.usm.maine.edu>.
There is no init method, i'm just suggesting:

<xsp:page>
<xsp:logic>
    int initialized = 0;
</xsp:logic>

<page>
<xsp:logic>
    if ( initialized == 0 )
    {
        // do init stuff here

        initialized = 1;  // this block will never be reached again.
    }
</xsp:logic>
</page>
</xsp:page>

Hope this helps. Perhaps someone else has another idea?

-matt


----- Original Message -----
From: "Frans Thamura" <ft...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Friday, June 01, 2001 1:24 AM
Subject: Re: init() and destroy() in XSP


> Matt,
> I don't understand, I need your help.
>
> I create a lot of xsp:page, but never find init()
> Would you give the simple work sample?
>
> Frans
> ----- Original Message -----
> From: "Matthew Cordes" <co...@cs.usm.maine.edu>
> To: <co...@xml.apache.org>
> Sent: Friday, June 01, 2001 3:01 PM
> Subject: Re: init() and destroy() in XSP
>
>
> > There are work-arounds though:
> >
> > INIT:
> > Make a global variable, set it to null, inside your <xsp:page> block
check
> > to see if it is null and do init stuff, then set it to something else.
> >
> > DESTROY:
> > wouldn't  overloading void finalize() { ... } work here?
> >
> > -matt
> >
> >
> >
> > ----- Original Message -----
> > From: "Frans Thamura" <ft...@yahoo.com>
> > To: <co...@xml.apache.org>
> > Sent: Thursday, May 31, 2001 11:38 PM
> > Subject: Re: init() and destroy() in XSP
> >
> >
> > > Ya, one of cocoon problem is no init and destroy
> > >
> > > ----- Original Message -----
> > > From: "Polley Christopher W" <Po...@JohnDeere.com>
> > > To: <co...@xml.apache.org>
> > > Sent: Friday, May 04, 2001 9:16 PM
> > > Subject: init() and destroy() in XSP
> > >
> > >
> > > > Hello, all:
> > > >
> > > > I have an XSP page in which  I would like to do some setup (open
JDBC
> > > > connection, create prepared statements) upon instantiation and
cleanup
> > > > (close ps's and connection) upon destruction.
> > > >
> > > > In its previous life as a jsp page, it used jspInit() and
> jspDestroy(),
> > > and
> > > > in a servlet it could use init() and destroy().
> > > >
> > > > I found XSPPage.init(parameters), which I can override to do the
> > > > initialization, but I am unclear on the tail end of the xsp life
> cycle.
> > > How
> > > > & when is it destroyed (in Cocoon 1.8.1) ?  How is this type of
thing
> > done
> > > > in XSP?
> > > >
> > > > I suppose that in this case, in which I am only doing JDBC stuff, I
> > could
> > > > try the sql taglib, but am unclear on how that would be done.  Can
> > > > <?cocoon-process type="sql"?> safely be placed ahead of
> <?cocoon-process
> > > > type="xsp"?>? What would the resultant xsp-servlet look like?
> > > >
> > > >
> > > > Thanks,
> > > > Chris
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > Please check that your question has not already been answered in the
> > > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > > >
> > > > To unsubscribe, e-mail: <co...@xml.apache.org>
> > > > For additional commands, e-mail: <co...@xml.apache.org>
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <co...@xml.apache.org>
> > > For additional commands, e-mail: <co...@xml.apache.org>
> > >
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: init() and destroy() in XSP

Posted by Frans Thamura <ft...@yahoo.com>.
Matt,
I don't understand, I need your help.

I create a lot of xsp:page, but never find init()
Would you give the simple work sample?

Frans
----- Original Message -----
From: "Matthew Cordes" <co...@cs.usm.maine.edu>
To: <co...@xml.apache.org>
Sent: Friday, June 01, 2001 3:01 PM
Subject: Re: init() and destroy() in XSP


> There are work-arounds though:
>
> INIT:
> Make a global variable, set it to null, inside your <xsp:page> block check
> to see if it is null and do init stuff, then set it to something else.
>
> DESTROY:
> wouldn't  overloading void finalize() { ... } work here?
>
> -matt
>
>
>
> ----- Original Message -----
> From: "Frans Thamura" <ft...@yahoo.com>
> To: <co...@xml.apache.org>
> Sent: Thursday, May 31, 2001 11:38 PM
> Subject: Re: init() and destroy() in XSP
>
>
> > Ya, one of cocoon problem is no init and destroy
> >
> > ----- Original Message -----
> > From: "Polley Christopher W" <Po...@JohnDeere.com>
> > To: <co...@xml.apache.org>
> > Sent: Friday, May 04, 2001 9:16 PM
> > Subject: init() and destroy() in XSP
> >
> >
> > > Hello, all:
> > >
> > > I have an XSP page in which  I would like to do some setup (open JDBC
> > > connection, create prepared statements) upon instantiation and cleanup
> > > (close ps's and connection) upon destruction.
> > >
> > > In its previous life as a jsp page, it used jspInit() and
jspDestroy(),
> > and
> > > in a servlet it could use init() and destroy().
> > >
> > > I found XSPPage.init(parameters), which I can override to do the
> > > initialization, but I am unclear on the tail end of the xsp life
cycle.
> > How
> > > & when is it destroyed (in Cocoon 1.8.1) ?  How is this type of thing
> done
> > > in XSP?
> > >
> > > I suppose that in this case, in which I am only doing JDBC stuff, I
> could
> > > try the sql taglib, but am unclear on how that would be done.  Can
> > > <?cocoon-process type="sql"?> safely be placed ahead of
<?cocoon-process
> > > type="xsp"?>? What would the resultant xsp-servlet look like?
> > >
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > > To unsubscribe, e-mail: <co...@xml.apache.org>
> > > For additional commands, e-mail: <co...@xml.apache.org>
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: init() and destroy() in XSP

Posted by Matthew Cordes <co...@cs.usm.maine.edu>.
There are work-arounds though:

INIT:
Make a global variable, set it to null, inside your <xsp:page> block check
to see if it is null and do init stuff, then set it to something else.

DESTROY:
wouldn't  overloading void finalize() { ... } work here?

-matt



----- Original Message -----
From: "Frans Thamura" <ft...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Thursday, May 31, 2001 11:38 PM
Subject: Re: init() and destroy() in XSP


> Ya, one of cocoon problem is no init and destroy
>
> ----- Original Message -----
> From: "Polley Christopher W" <Po...@JohnDeere.com>
> To: <co...@xml.apache.org>
> Sent: Friday, May 04, 2001 9:16 PM
> Subject: init() and destroy() in XSP
>
>
> > Hello, all:
> >
> > I have an XSP page in which  I would like to do some setup (open JDBC
> > connection, create prepared statements) upon instantiation and cleanup
> > (close ps's and connection) upon destruction.
> >
> > In its previous life as a jsp page, it used jspInit() and jspDestroy(),
> and
> > in a servlet it could use init() and destroy().
> >
> > I found XSPPage.init(parameters), which I can override to do the
> > initialization, but I am unclear on the tail end of the xsp life cycle.
> How
> > & when is it destroyed (in Cocoon 1.8.1) ?  How is this type of thing
done
> > in XSP?
> >
> > I suppose that in this case, in which I am only doing JDBC stuff, I
could
> > try the sql taglib, but am unclear on how that would be done.  Can
> > <?cocoon-process type="sql"?> safely be placed ahead of <?cocoon-process
> > type="xsp"?>? What would the resultant xsp-servlet look like?
> >
> >
> > Thanks,
> > Chris
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>