This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes display html and pop up save dialog box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "display html and pop up save dialog box" Watch "display html and pop up save dialog box" New topic
Author

display html and pop up save dialog box

Bhumika Thakkar
Ranch Hand

Joined: Apr 18, 2005
Posts: 79
Hello Everyone,

I have a html page that displays a table. I'd like to dispay the table to the client and pop up a dialog box to save that same html, both in one request. Is that possible?

Thanks in advance,

Bhumika.


SCBCD (Preparing) <br />SCWCD, 82%<br />SCJP, 90%
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
Hi,
I think this is not the exact forum to discuss your solution. This is completely for scwcd preparation. Any way,
why dont u submit another form/iframe(from same page) onload of the html page, redirecting to the same page and you can set appropriate headers second time to display the popup?


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Bhumika Thakkar
Ranch Hand

Joined: Apr 18, 2005
Posts: 79
Thanks for the response.
i don't want to make another trip to the server...
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
I dont think that you can make this in one round trip.
'content disposition' header can be either be inline or attachment at a time. We cannot have both. Though it is possible to add two values for same header(not sure for what are all header we can add!!), using response in the following way.
response.setHeader("Content-Disposition", "inline");
response.addHeader("Content-Disposition", "attachment;filename=test.txt");
I guess it is up to the browser whether it can understand/interpret the document as both inline and attachment same time.
Atleast my browser(IE 6.0) doesnt understand both at same time. I am not sure which spec defines about interpreting multiple values of header.

HTH.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: display html and pop up save dialog box
 
Similar Threads
Javascript funtion for open dialog box
Is there an event for a file download?
How to avoid open/Save dialog box while downloading?
File Download Dialog
Very urg help me