Hi Sezhiyan,
There isn't any "standard" way of doing this... what's happening is that
the request is coming back just like any other would that updates what
the user sees. As you mentioned though, the save as dialog appears
instead... there is no event you can hook that will tell you when the
page is loaded because, in essence, the browser is expecting a new page
that would overwrite any event you could hook even if one existed.
There's a couple of ways I can think of to do this...
(1) Perhaps the easiest is to target your form submission (or link) that
gets the CSV to _new. This will open a popup that will be the target of
the return... since it's a save as dialog, the popup should, I believe,
go away, leaving just the save as dialog. This wouldn't help you
determine when to change back to the default cursor though... you could
kick off a timer to change it back in a few seconds.
Before I forget, note that changing to an hourglass isn't stopping the
user from clicking more than once, it's just a visual cue that they
shouldn't. You may want to disable the button instead of changing
cursors. The same problem of knowing when to change back applies though :)
(2) Use AJAX to get the CSV, then display it to the user, perhaps in a
new window, perhaps in a <div> on the same page. You'll know exactly
when to switch the cursor back in this case.
(3) If you can use frames, have a hidden frame (cols/rows=0) and target
that... you can then kick off a timer in your main frame that checks the
document status. When its complete, change the cursor back.
(4) Kind of a hybrid of 1 and 3... open a new window, and in response to
onLoad, make the call that gets the CSV... Put a message that says
"After the Save As dialog appears, please click here" and when they
click here, call a function back in the parent window that resets the
cursor.
Hope that helps!
Frank
Balasubramaniam, Sezhiyan wrote:
Though this is not a direct struts question, hope I will some guidance
for my issue.
In one of our struts application, we have a CSV download functionality.
We use response.setContentType("application/csv;").
When the download happens, user has no clue about the state of the
request and keeps on clicking the submit button.
So we changed cursor to hour-glass on the form submit. This technique
works well with the other pages where response shown in the browser
itself.
But in the csv download, the page stays as it is, but the response comes
as a windows dialog for saving it or to open it.
What happens is, even after the download, the mouse stays as hourglass.
Can somebody advice me, which event, we have to look for, to turn the
mouse to default, after the page download?
Thanks in advance.
---------------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]