The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
Page 2 -
How to export data from servlet to excel file through poi lib
Page 2 - Discuss How to export data from servlet to excel file through poi lib in the Java Help forum on Dev Shed. How to export data from servlet to excel file through poi lib Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 13th, 2012, 09:18 AM
|
 |
Java Junkie
|
|
Join Date: Jan 2004
Location: Mobile, Alabama
|
|
Quote: | Originally Posted by nicholas.omosa yes i do |
In this part of your code
Code:
FileOutputStream fileOut = new FileOutputStream("c:\\excelFile.xls");
wb.write(fileOut);
fileOut.close();
out.println("Data is saved in excel file.");
con.close();
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
}
}
did you also put a print statement in the catch block?
|

November 13th, 2012, 09:22 AM
|
|
Contributing User
|
|
Join Date: Nov 2012
Posts: 34
Time spent in forums: 4 h 44 m 5 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by bullet In this part of your code
Code:
FileOutputStream fileOut = new FileOutputStream("c:\\excelFile.xls");
wb.write(fileOut);
fileOut.close();
out.println("Data is saved in excel file.");
con.close();
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
}
}
did you also put a print statement in the catch block? |
i dont think i did how do you do that ?
|

November 13th, 2012, 09:24 AM
|
 |
Contributing User
|
|
Join Date: May 2004
Location: Superior, CO, USA
|
|
|
I don't understand your issue. In the code you show you're doing nothing but getting a database connection. If you want some output then you have to actually output something. I would totally expect a blank page from the code you showed.
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.
|

November 13th, 2012, 09:35 AM
|
|
Contributing User
|
|
Join Date: Nov 2012
Posts: 34
Time spent in forums: 4 h 44 m 5 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by stdunbar I don't understand your issue. In the code you show you're doing nothing but getting a database connection. If you want some output then you have to actually output something. I would totally expect a blank page from the code you showed. |
good, now i think we are on the same page..so how do i get the output?
|

November 13th, 2012, 09:37 AM
|
 |
Java Junkie
|
|
Join Date: Jan 2004
Location: Mobile, Alabama
|
|
Quote: | Originally Posted by nicholas.omosa good, now i think we are on the same page..so how do i get the output? |
I'm confused. I was under the impression that you were demonstrating in the post with the smaller amount of code that you had modified the original servlet so you could display the exceptions. Did you only have the new code as the servlet? In that case, I agree with stdunbar that it won't do anything.
|

November 13th, 2012, 09:40 AM
|
|
Contributing User
|
|
Join Date: Nov 2012
Posts: 34
Time spent in forums: 4 h 44 m 5 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by bullet I'm confused. I was under the impression that you were demonstrating in the post with the smaller amount of code that you had modified the original servlet so you could display the exceptions. Did you only have the new code as the servlet? In that case, I agree with stdunbar that it won't do anything. |
ok bullet and stdunbar..how do i print the output put of my query?
|

November 13th, 2012, 09:43 AM
|
 |
Java Junkie
|
|
Join Date: Jan 2004
Location: Mobile, Alabama
|
|
Quote: | Originally Posted by nicholas.omosa ok bullet and stdunbar..how do i print the output put of my query? |
If you use a simple System.out.println it should show up in the log file or if you use out.println it should show up on the screen. (Assuming you have create a PrintWriter called out.)
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|