• 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

request attributes in new request from javascript?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application where when the user submits the page, I want a report to come up in a new window, using the parameters that the user entered on the page. The current implementation opens the report in the same page, causing me to lose the rest of the application, because the report is a PDF. As it is right now, the parameters are being pass to the report renderer servlet via a request attribute. I would like to set it up so that when the user submits, it puts all the params into the request attribute, then forwards to the page again, but have javascript in the page to check for that request attribute, and if it is there, do a javascript openWindow call to call the servlet. However, I can't figure out how to get that request attribute into the new request being called from the javascript. Is this something that can even be done? How do I pass request attributes from a javascript new window call? If it can't be done, does anyone have any good ideas on another way to make the report open up in a new window? We are using Struts 1.2.7 for this application and the report renderer is a separate servlet.
This code works, but is not passing the parameters, of course, and so the report fails.
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you just set the Content-Disposition header correctly?
 
K Dombroski
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool, I did not know I could do that. Setting it to attachment does add in a prompt asking if they want to open or save, but I don't think the users will mind. Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic