Let me try another scenario: let say that the generated text for the "out"
is not one iamge, but some number between 0 and 5. the correct number of
images will be clear only after the execution of the thread. In this case, I
do want to continue with the JSP and write to the "out" later on.
The only think I thought of was to write something like "{1}" (instead of
tag) and when the page is over it will replace "{1}" with the right code
from the thread. This will require me to get the generated page from the JSP
and manipulate it after Jasper has finished with it.
Any better way to do it?

-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 28, 2007 7:04 PM
To: Tomcat Users List
Subject: Re: multithreaded with taglibs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yair,

Yair Ben-Meir wrote:
> This solution is good but we must write to the out of the jsp before the
> thread is running (we bypass this because the thread will write to a
> pre-decided file name). is there another way to do it, without writing to
> the out?

I'm not sure I understand what you mean. Are you asking how to continue
evaluating the JSP while the image is being generated? Easy. Create a
class like this:

public class ParallelImageGenerator
{
    public ParallelImageGenerator() { ... }

    public String getGeneratedFilename() { ... }

    public void start() { ... }
    public void wait() { ... }
}

Then, from your tagStart method in your custom tag library, do something
like this:

pig = new ParallelImageGenerator();
pig.start();

jspOut.print("<img src=\"" + pig.getGeneratedFilename() + "\" />");

// Register the 'pig' object somewhere so you can go back and "wait"
// on all of the image generators.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTZ9n9CaO5/Lv0PARAkxKAKCP/PK410pUbBTrWxS9G5fIhE6aYgCfb6dJ
0RnxBh6+CfToeccD3lgS/6M=
=Iksk
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to