tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yair Ben-Meir" <yair.ben-m...@sundaysky.com>
Subject RE: multithreaded with taglibs
Date Thu, 29 Nov 2007 10:14:40 GMT
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:chris@christopherschultz.net] 
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



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


Mime
View raw message