You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Izzo, Graziano" <GI...@na.atos.it> on 2001/01/16 17:01:27 UTC
same sample of threads in xsp pages
Hi people, i try to implement thread in xsp page.
My problem is:
in my file.xml i call a select on a large db.
While it complete its work it useful for me
to have on a wap browser same message like
"wait please".
Could i have same sample about this problem?
thanks a lot
Graziano
Re: same sample of threads in xsp pages
Posted by I-Chung Young <ic...@puma.mt.att.com>.
One of my colleague did that. He uses a combination of
thread and session. The page looks like (not exact page):
<xsp:page>
<xsp:logic>
//declare your thread class
class YourThread extends thread {
//it will put the database result in session using
// setAttribute("result", result) (result could be
// a vection or string, or filename of the output)
// setAttribute("status", "done");
}
</xsp:logic>
<page>
String status=session.getAttribute("status");
if (status==null) { // first time
YourThread t = new YourThread(input);
t.start(); // do the DB stuff
session.setAttribute("status", start);
<jump delay="50">
<xsp:attribute name="href">request.getRequestURI()</xsp:attribute>
<msg>Processing...</msg>
</jump>
} else if (status=="start") { // thread not finished yet
<jump delay="50">
<xsp:attribute name="href">request.getRequestURI()</xsp:attribute>
<msg>Waiting...</msg>
</jump>
} else { // processing thread is done
vector result=(vector)session.getAttribute("result");
session.removeAttribute("result");
// processing output
}
</page>
</xsp:page>
Then the XSL take care of the <jump> and translate into
<onevent timer> (or any equivalent in HDML/WML/HTML)
and refresh the page.
However, be aware that we have some occasion that the
client stuck at "waiting page" and the back end thread
seems to hang or disappear. It may be our own bug.
HTH.
------------
I-Chung Young
ichung@puma.mt.att.com
On Tue, 16 Jan 2001, Izzo, Graziano wrote:
> Hi people, i try to implement thread in xsp page.
> My problem is:
> in my file.xml i call a select on a large db.
> While it complete its work it useful for me
> to have on a wap browser same message like
> "wait please".
>
> Could i have same sample about this problem?
>
> thanks a lot
> Graziano
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>