This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help while exporting CSV file using JSP

 
pushpa naga
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

while exporting csv file from jsp im getting empty csv file.

Any help is much appreciated.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not even be attempting to do stuff like this in JSP. JSP is for generating HTML pages, not computation and manipulation of output streams.

Save yourself lots of trouble and look into servlet code designed to handle file transfer.

Bill
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pushpa,
Are you getting the correct values in sbf?




 
Dave Tolls
Ranch Hand
Posts: 2285
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you're not getting an IllegalStateException?
Because I'm pretty sure using getOutputStream inside a JSP page will result in that (at least it used to) as the JSP has already called getWriter to write its own stuff out as pretty much the first thing it does.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bottom line, you are using the wrong tool.



Move all this code to a servlet as your first step.
 
Dave Tolls
Ranch Hand
Posts: 2285
25
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That resembles some of my DIY attempts...
:)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!