• Post Reply Bookmark Topic Watch Topic
  • New Topic

request attributes in new request from javascript?

 
K Dombroski
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!