Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem stems from the fact that you are trying to go against the 'single response per request' model in J2EE, and have the end-user's page dynamically update as the backend task executes.</p> <p>Unless you want to go down the introducing an Ajax-based solution, you will have to force the rendered page on the user's browser to 'poll' the server for information periodically, until the back-end task completes. </p> <p>This can be achieved by:</p> <ol> <li><p>When the J2EE container receives the request, spawn a thread which takes a reference to the session object (which will be used to write the output of your script)</p></li> <li><p>Initialize the response servlet to write an html page which will contain a Javascript function to reload the page from the server at regular intervals (every 10 seconds or so). </p></li> <li><p>On each request, poll the session object to display the output stored by the spawned thread in step 1</p></li> <li><p>[clean-up logic can be added to delete the stored content from the session once the thread completes if needed, also you can set any additional flags in the session for mark state transitions of the execution of your script]</p></li> </ol> <p>This is one way to achieve what you want - it isn't the most elegant of all approaches, but it is essentially due to needing to asynchronously update your page content from the server , with a request/response model.</p> <p>There are other ways to achieve this, but it really depends on how inflexible your constraints are. I have heard of <a href="http://directwebremoting.org/dwr/index.html" rel="nofollow noreferrer"><strong>Direct Web Remoting</strong></a> (although I haven't played with it yet), might be worth taking a look at <strong><a href="http://today.java.net/pub/a/today/2007/03/22/developing-applications-using-reverse-ajax.html" rel="nofollow noreferrer">Developing Applications using Reverse-Ajax</strong></a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload