• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Code for transfering data from JSP to Excel Sheet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic