Hi all.
In my JSF application I have a link (t:commandLink) on click of which I want
to send an attachment to the user. The usual way in struts was
snippet:
response.setHeader ("Content-Disposition","attachment;filename=\"mae.csv\
"");
response.setContentType("text/csv");
response.getOutputStream().write(file.getBytes()); // file is some object
which return bytes
response.getOutputStream().flush();
response.getOutputStream().close();
When I do this in JSF, I also do in the end:
FacesContext.getCurrentInstance().responseComplete();
Works fine - But after I have the file, I try to do something else (Another
action), I get the error:
*View state couldn't be restored, reload?*
I guess it is because JSF loses the view (for some reason I don't know).
What is the right way to send an attachment to user with *PURE JSF*solution.
I read in some places about using shale, servlets, etc.. But I want a pure
JSF solution. Help, anyone?
Thanks in advance.
Cheers.