File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Export to Excel using Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Export to Excel using Jsp" Watch "Export to Excel using Jsp" New topic

Export to Excel using Jsp

Raghu Kalyan

Joined: Jan 18, 2007
Posts: 2
Hi , i have a jsp which has data and needs to be exported to excel sheet. I included the below two lines in my jsp, <%response.setContentType("application/;charset=windows-1251");%> <%response.setHeader("Content-Disposition", "attachment; filename=downloadOrders.xls" );%> i have one column which stores data like 1.1,2.1,3.1,... But in english it is printing correctly when i switch to russian language through regional settings in my PC. It is printing like below, 01月01日 (for 1.1) 02月01日 (for 2.1) Can you please help to resolve this issue wheather i need to change the charset or need to modify the code. Thanks in advance
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Kalyan, Please check your private messages.

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Did you try to change the encoding and see what happens?

Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
Resurrecting this to share:
I combined simple techniques found here:
and here:

1. Table data
Table data gets dynamically generated, and I surround it with a div tag:

2. Export button
on the page with my TABLE data, I add the following HTML:

3. Export Script
add this JS on top:

3. The JSP Export page
This new page excel.jsp does all the work:
I agree. Here's the link:
subject: Export to Excel using Jsp
It's not a secret anymore!