tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yair Ben-Meir" <>
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 [] 
Sent: Wednesday, November 28, 2007 7:04 PM
To: Tomcat Users List
Subject: Re: multithreaded with taglibs

Hash: SHA1


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();

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

Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message