This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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]
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).