File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pdf and forward

 
Jason Pillgrim
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I would like to know if what I'm trying to do is possible...
My goal is to provide a submit button to user that will invoke a struts Action which will generate a pdf document and send it back to him. What I'm doing is to write the document in the response and to change the header mime type. This works great, but what I need to do is to send the user to other page, I mean, he would click the button and he would be presented in another page and he would recieve the pdf document.

Is there a way to get this functionality or di I have a bad nightmare??

Thanks in advance.
 
Tarun Yadav
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can't forward after sending the file to the user. And if you submit/ link to the file servlet, then the page doesn't get displayed, you'll directly get the download dialog box.

I guess, you could forward to a new page where you can use JavaScript to invoke the download servlet; this seems to be a very common design with download sites. Don't forget to give a direct link in case the submit/ redirect/ refresh fails!
 
Jason Pillgrim
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tarun, I think it's a good idea.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic