Back Forum Reply New

Triggering a file download in a SimpleFormController?

Hi,

I have a form which has a couple of checkboxes. When the user submits the form, they should be prompted with a file download dialog containing a different file based on the options they selected. In a normal Controller, I'd do something like this...PHP Code:
publicnbsp;ModelAndViewnbsp;handleRequest(fromServletRequestnbsp;request,nbsp;fromServletResponsenbsp;response)nbsp;throwsnbsp;ServletException,nbsp;IOException,nbsp;SQLExceptionnbsp;{response.setContentType("text/xml");response.addHeader("Content-Disposition",nbsp;"attachment");OutputStreamnbsp;onbsp;=nbsp;response.getOutputStream();//Writenbsp;tonbsp;outputnbsp;streamnbsp;herereturnnbsp;null;

But a SimpleFormController doesn't recieve the fromServletResponse object. How can I cause a file download through a form controller? If that's not possible, how should I tackle this seemingly common problem?

Thanks.

But a SimpleFormController doesn't recieve the fromServletResponse object. How can I cause a file download through a form controller? If that's not possible, how should I tackle this seemingly common problem?

Where did you get that from?? Have you actually taken a look at the API?

Thanks for that. Must've missed it.
¥
Back Forum Reply New