import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
...
@RequestMapping("/csvtest.csv")
public void generateCSV(Map model,
HttpServletRequest req,
HttpServletResponse resp)
throws Exception
{
resp.setContentType("application/spc; charset=UTF-8");
resp.setHeader("Content-Disposition","inline;filename=rep.csv");
ServletOutputStream out = resp.getOutputStream();
out.println("THIS IS A TEST, test2");
out.flush();
out.close();
}
Download CSV file Using Java Springframework.
| Forum > Programming Lanuages > Java > Download CSV file Using Java Springframework. | Login or register to post. |
| Login to reply | Page: « < 1 of 1 > » |
| 02 Dec 2009 - 17:20 | 651 |
| tkubendr Super Admin Joined: 12 Nov 2007 Posts: 85 | Download CSV file Using Java Springframework. When a user hits the csvtest.csv URL, it will download a file called rep.csv on to their screen with a file that has This is a test inside.
|
![]() |
| Login to reply | Page: « < 1 of 1 > » |

