This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes jsp to excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "jsp to excel" Watch "jsp to excel" New topic
Author

jsp to excel

bala chidambaram
Greenhorn

Joined: Jan 19, 2004
Posts: 24
hai
I found following code working.
<%@ page contentType="application/vnd.ms-excel" %>
<% out.println("bala"+"\t"+"chidambaram"); %>

like this can i place variables( rs.getString(1) ) read from database instead of string contants(bala,chidambaram).
suggestions are welcome
thank u.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Your browser will try to treat the output like an XLS file and use Excel to render it.
If Excel can't understand what you're sending, it will not render it correctly and/or give errors.
It's up to you to format the output correctly. CSV format works for simple data, SLK for more complex stuff.
Or you may want to look at packages like POI to generate binary Excel data and try to send that.
IMO you'd better not use a JSP to generate Excel data, a servlet (possibly using an XSL transformation or Jython script) is far better suited.


42
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: jsp to excel
 
It's not a secret anymore!