• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forwarding after response committed

 
pamir sonmez
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an action method that is called from a jsp page,




When file is written to the response, dialog-box appears and I save file to my local computer.
But the forward does not work since;


Since I wrote to the response I can not forward after that.
Is there any possibility that I can forward this request to the another page?
Or can you suggest another way of implementing this function?
(i.e save file to the session and redirect another page etc....)

Thanks
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The general approach is that you open a page first in the browser and the browser will then call this action to get the report file. So basically instead of calling this action directly, you'll show a web page in the browser. After the web page completes loading, it will redirect the browser to this action (look here to know how to do this). This way the user will see a web page and then the download will begin. You'll not need to store the report in session too which will save server memory. In your action you'll return null so that after the report is sent the action won't try to forward to any JSP page...
 
pamir sonmez
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could not understand what you mean exactly

Ankit Garg wrote:The general approach is that you open a page first in the browser and the browser will then call this action to get the report file. So basically instead of calling this action directly, you'll show a web page in the browser.

In a jsp page, there is a button , when I clicked it action is called


Ankit Garg wrote:
After the web page completes loading, it will redirect the browser to this action (look here to know how to do this). This way the user will see a web page and then the download will begin.

In action method, when I created the file, if I dont write it to the response, how will user download it?
Or I have to save it to the session?


Ankit Garg wrote:
You'll not need to store the report in session too which will save server memory. In your action you'll return null so that after the report is sent the action won't try to forward to any JSP page...


Will be another action method?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic