0

I have a JSF Web application, and at some point i present the client a big chunk of information, I want to have a save as link, that allows the client to save this information on his computer as a .txt file.

Information on how to achieve this or a good tutorial would be great.

Oscar Gomez
  • 18,436
  • 13
  • 85
  • 118

2 Answers2

1

Does this work for you? You probably would need to set the ContentType to "application/octet-stream", otherwise the client's browser will display your text file instead of offering the option to "Save as".

Community
  • 1
  • 1
emboss
  • 38,880
  • 7
  • 101
  • 108
0

I believe your best bet may be to have that link actually generate an Ajax call to generate the text file and set it as the src attribute of an iframe on the page. That will trigger (I think) the file download box.

josh.trow
  • 4,861
  • 20
  • 31