• 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

PDF Download - Outputstream

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts and my application downloads data to the browser in a PDF file. To make sure the download was successfull I close the stream or flush it. Now I want to continue with my session by forwarding to another Struts action, unfortunately when the request is closed you cannot do a thing. Is there a way to move to another Structs action in this scenario?

what if you want to give the user a confirmation screen with additional info.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible solution would be to have your action forward to a confirmation page instead of directly returning the PDF file output stream. The confirmation page would list any additional information you want to give, and also provide a link to perform the actual download. In the link, specify target="_blank" so that the PDF is rendered to a new window. Once the user closes the PDF window, your original confirmation page is still available for the user to navigate back to other pages in your application.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want it to be more automatic than that, here's another option:

Instead of putting a link on the confirmation page, you could put JavaScript code in the on load method of the <body> tag to open a new window and call the URL for downloading the PDF. That way, to the user it appears as if you've opened both the PDF window and the confirmation window at the same time.
reply
    Bookmark Topic Watch Topic
  • New Topic