Java – Generate CSV from Java Bean using OpenCSV

Download OpenCSV:

OpenCSV is a free and open source library for reading and writing CSV files in Java. We need to have latest opencsv jar in classpath. Following example shows generating a CSV from java beans using opencsv.


Generated CSV :

Java – Generic Interface Example

Java Struts – Logging with Log4j Example

Download Log4j:

Log4j Appender:
Create a Log4j properties file ( and define the appender details (where to log and log file details). And put the into your project classpath.

Struts Action Class:

Struts Custom Exception Handler:

Log4j Output File Sample- c:\\logging.log