how to convert jsp data to excel??

R

rishi

I m working on one project where in that there is a
report section in which we display data on jsp by
feching the data from the database.all is working good
but i want to include on button on jsp page and after
clicking that button that jsp page genrate excel sheet
and excel sheet display the data in the same sequence
how the jsp displaying the data.
If anyone have code for generating the excel sheet
please provide me the code.
 
J

Joe Attardi

rishi said:
I m working on one project where in that there is a
report section in which we display data on jsp by
feching the data from the database.all is working good
but i want to include on button on jsp page and after
clicking that button that jsp page genrate excel sheet
and excel sheet display the data in the same sequence
how the jsp displaying the data.
If anyone have code for generating the excel sheet
please provide me the code.

Please stop spamming the group. If someone has an answer for your
question they will post it.
 
N

Nino

I m working on one project where in that there is a
report section in which we display data on jsp by
feching the data from the database.all is working good
but i want to include on button on jsp page and after
clicking that button that jsp page genrate excel sheet
and excel sheet display the data in the same sequence
how the jsp displaying the data.
If anyone have code for generating the excel sheet
please provide me the code.

I have created a file that creates a CSV file and stores it on the
server. After the file has been created, users can click on a link to
download it. This file can be opened using Excel and other spreadsheet
programs, but you will not get the same "nice" formatting you would
get that is displayed on HTML.

Here the code snippet:

<% try {
String fileName = "/<directory to store file>/
export-"+request.getParameter("e")+".csv";
DataOutputStream oFile = new DataOutputStream(new
FileOutputStream(fileName));

StringBuffer sb = new StringBuffer();
sb.append("User ID,Name,Email\n");

db_query = "select user_id, name, email from TABLE'";
db_result = stmt.executeQuery(db_query);
while (db_result.next()) {
sb.append( db_result.getString("user_id") +","+
db_result.getString("name") +","+ db_result.getString("email") +"\n");
}

oFile.writeBytes(sb.toString());
oFile.close();

} catch (Exception e) {
flag_error = true;
} %>
 
T

TobiMc3

I m working on one project where in that there is a
report section in which we display data on jsp by
feching the data from the database.all is working good
but i want to include on button on jsp page and after
clicking that button that jsp page genrate excel sheet
and excel sheet display the data in the same sequence
how the jsp displaying the data.
If anyone have code for generating the excel sheet
please provide me the code.

http://faq.javaranch.com/view?JspAndExcel

Tobi
 
Joined
Aug 16, 2021
Messages
1
Reaction score
0
I m working on one project where in that there is a
report section in which we display data on jsp by
feching the data from the database.all is working good
but i want to include on button on jsp page and after
clicking that button that jsp page genrate excel sheet
and excel sheet display the data in the same sequence
how the jsp displaying the data.
If anyone have code for generating the excel sheet
please provide me the code.
hai you got any answer .if u know the answer please send me code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top