• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dialog not opening

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In action class method i am setting the response as attachment.

response.setHeader("Content-disposition", "attachment; filename=" + fileName);

so when this is called by the jsp page a download dialog is opened to download the attachmetn (which is decided by the browser depending upon the header).

Now the scenario is that i want to call the same code from java applet and i want that a download dialog should be open like the way it is opened when call is made from jsp page to download the attachment whereas currently download dialog is not opened when the call is made from the java file.

How this can be done so that download dialog is opened to save the attachment in the desired location when the call is made from java applet.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can pop-up dialogs from an applet, though it may be better to put a layer over the applet itself (see this old post, keep in mind things may have changed since I last looked at it).
This question doesn't have anything to do with Struts, so I'll move it to the Applet forum.
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually when the action class code is called from the JSP page the windows download dialog is opened as the header type is set as an "attachment".


My ques is that is there any way to launch the same windows download dialog instead of creating our own dialog in swing?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understood your question. My answer is "no", applets don't have the functionality to prompt a user to save a file.
On second thought, you may be able to use the showDocument method of AppletContext to open the URL you wish to download in a new browser window and the browser would use the regular "save as" dialog.
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, i will AppletContext and see if it is helpful for my scenario and will let you know in case any clarification is required.

thanks a log
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The bottom line is: your applet will have to persuade the browser to send the request, so that it receives the response and pops up that dialog box. So you would use the same code which would cause the browser to display a new HTML page.
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And how it can be done exactly??
 
john sal
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Joe it worked .. thanks a lot . I used AppletContext and passed the page URL whose response is an attachment. AppletContext tried to open it in a browser and because the response header contains type as an attachment browser's download dialog got opened.

Thanks again ..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic