permaculture playing cards*
The moose likes JSP and the fly likes Code for transfering data from JSP to Excel Sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Code for transfering data from JSP to Excel Sheet" Watch "Code for transfering data from JSP to Excel Sheet" New topic
Author

Code for transfering data from JSP to Excel Sheet

nageshwar reddy
Greenhorn

Joined: Sep 14, 2009
Posts: 2
hi all,

can any one send me the details what to do to tranfer tha JSP data(which is from database) to the excel sheet.
Actually i have a set of data records(from Database) in the JSP page and i have a button like "PRINT".When i click the "PRINT" button i need to transfer the records to an MS-Excel Sheet.

I need the full details regarding this(including the code) please.


Thanks& Regards,

C.G.Nageshwar Redddy
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
nageshwar reddy wrote: I need the full details regarding this(including the code) please.

Making things a bit too trivial now aren't we?
While I'm not really inclined to sit down and write the whole implementation for you, I can only suggest that the most logical thing to achieve what you need to do is - make another query to the database, recreate your data structures, and create an XLS datasheet using an XLS based Java API like POI.
You could also put the data-structures you created for displaying on the JSP in your session as an attribute. This way you won't have to re-create them. But that would be really bad [assuming you're not dealing with small sized data here]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
Do you need to preserve whatever formatting (fonts, bold, alignment, etc.) is used as well? If so, a library like POI is indeed your only choice. If it's only the actual values you're interested in, you might as well just create a CSV file and stream that to the client (using one of the many available Java CSV libraries).


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code for transfering data from JSP to Excel Sheet