We have to export some data from Database to CSV file.
Frontend :JSP

So we are using ServletOutputStream and writing the data to a file in the Servlet.

To enable To show file save dialog box i am also doing this..

response.setContentType("text/plain");
response.addHeader("Content-Disposition","attachment;filename=\"" + fileName + "\"");

IT is showing FileSave dialog box when the output is less say like 20-50 Lines in the file.

But if the output is like more than 50lines then it is getting displayed the browser directly.
The filesave option is not coming up.
Please help