How To d/l pdf in struts


Web tier: servlets, JSP, Web frameworks: How To d/l pdf in struts

  1. How To d/l pdf in struts (2 messages)

    Hey, I am using struts 1.3.8 and have a problem that when the user clicks on a link an action is called in which i have to create a pdf file send to user for download and then redirect him to another page (both in the same click). The problem i am facing is that after i generate the pdf and send him on an output stream (ServletOutputStream) the new page is not displayed and it throws a response already committed error. Can anybody please help me in this regards how do i achieve this. Thanks a lot
  2. How To d/l pdf in struts[ Go to top ]

    Your problem is that you only have one response for one request, so you cannot both write a PDF and also redirect in the same response. A solution could be to send the user to a page that has two links: One for the PDF and one for the page you want to show after the download. The link for the PDF has target="_blank" to open in a new window. Then you submit both links using javascript, which means the PDF download will start in a separate window and the next page will be shown in the same window. If you need a general file management module in your Java web application, may I recommend JEExplorer: Which, incidentally, we develop.
  3. I would rather send the user to the new redirect page with some PK of the pdf as a parameter - first. and call the pdf download action as a redirect from that page Click -> redirect page (Thank you) -(meta/js redirect)-> pdf download