• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to output JSP page to Excel ?  RSS feed

 
Sudharshan Reddy Ch
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a requirement like I should convert my JSP output to Excel file by clicking a button. Please help me.

Sample code is more helpful.

Thanks & Regards,
Sudha C Reddi.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reanalyze your requirement into something that makes more sense. Like this: "Produce an Excel file containing the same data as the JSP in response to a button click".
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my form I've got a button "Save to Excel". I'm using jstl's if with a test whether the button was pressed and if so it sets a header and content type...viola an excel file with the html.

Ugh, if someone knows how to do this without the ugly scriptlet I'd be grateful for a tip.



[ October 27, 2006: Message edited by: Carol Enderlin ]
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Apache Poi for export to excel functionality .it is easy to use and we can even format each cell programtically. otherwise try response.setContentType();
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lots of ways to do it, comma delimited, poi, html, xml.
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article may be helpful.

http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For contentType approach, you might want to set it in the directive to cause the entire page to render as Excel



Cheers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!