Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dowloading a Table as a csv File

 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

In a JSF app, I am trying to find the best way to download a (HTML)table to the client as a CSV file (to be open with excel for example).

Any ideas?

Thanks!
Javo
 
John Smith
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parse the table to output a comma delimited list name.csv, when excel saves it back to that file it will be in the correct excel format.

if you're doing it through struts you can have it as a link pointing to an action containing the following:



This will create a file with your data and send it to the browser which will automatically deal with it by popping up a download box or displaying if the client has an excel plug-in installed, hope this is what you were after
 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

I would really like to test that.
But I am using JavaServer Faces...

What is the parallel to "response" in JavaServer Faces?

Regs,
javoso
[ December 13, 2004: Message edited by: Javoso Torso ]
 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:

FacesContext.getExternalContext().getResponse();

?
[ December 13, 2004: Message edited by: Javoso Torso ]
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to try JExcel API as well.

HTH,
- Manish
 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,

I am giving Apache POI a try!

Rgs,
javo
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic