Hi Andreas,

As you describe it, this isn't something you can do... well, *probably*... if you write to the output stream directly in the Action, the browser *might* render the partial response, I'm not actually sure (although I suspect not). Even if that did work though, it would be a pretty bad idea, and would also I think cause an exception if you then forwarded to a JSP.

What you will probably want to do instead depends on how long a transaction your really doing... if it's something that's going to take a few seconds, maybe 30 or less let's say, your best bet might be to display a please wait message client-side before sending the request. For instance:

<script>
  function showPleaseWait() {
    document.getElementById("entryForm").style.display = "none";
    document.getElementById("pleaseWait").style.display = "block";
  }
</script>
<div id="entryForm" style="display:block;">
  <form onSubmit="showPleaseWait();">
    // Some form elements here
  <form>
</div>
<div id="pleaseWait" style="display:none;">
  Please wait, processing...
</div>

Alternatively, you could implement a polling mechanism. Fire off your request, and start a thread to do the processing. Then, have the client continually check the status of the transaction (which is written out to a database maybe) via another Action. So the sequence would be something like:

1. User submits form
2. Action A is executed and starts processing thread, forwards to JSP A
3. JSP A returns "please wait" page, which includes script (or meta tag) to continually call status checking Action 4. Status checking Action is executed (x number of times), checks status of transaction (thread writes status to database for instance). If still running, forward to JSP A (just like the first Action). If complete, forward to JSP B
5. JSP B renders "all done" page, user can move on

HTH,
Frank

Andreas Hartmann wrote:
Hello,

is there a chance to send some data to the browser before the Action class
is ready and the jsp-file is processed?

Background:
I want to send at the beginning of the Action-class the info to the
client, that the system is working now and it will take some time to get
the output.


Thanks for any hint,
kind regards,
Andreas Hartmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



.


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to