tags:

views:

177

answers:

1

Hi,

I'm currently using Spring MVC.

What I'm looking to do is have a web page where once the user submits a form, the controller writes a file to the output stream then flushes it, so the user may save the file. But I would then like the contoller to return a modelview, taking the user to another page.

At the moment once the output stream has been flushed, when the modelview get's returned, I end up with a "getOutputStream() has already been called for this response" error. (Normally I would return null after flushing the output stream to avoid this error).

So what I'm asking is, is there a way I can flush the output stream so the user can download the file and then return a modelview so the user is taken to another page?

Cheers.

A: 

I don't think what you're looking for is exactly possible, no matter what web framework you use. Best alternative I can think of is doing it the way Sourceforge.net processes downloads, e.g. a page with 'your download will start shortly', here's an example. (click the download link on the page)

Hans Westerbeek