Backing Bean/CSV

Query CSV file from Java

Xpages Button

System Requirements:

Download Domino Designer 8.5.2 Environment (DDE)


Load XML file from C Drive using Java, create a CSV file.


Information contained in the following is presented as is. This tutorial assumes you have basic programming knowledge. All tutorials are based on an Eclipse/Eclipse-based software. Should you need to familiarize yourself with a certain Eclipse environment, prior to continuing this tutorial, please stop now and see our Tutorials page...

Write Java class to create CSV file

At this point we assume Domino Designer 8.5.2 is downloaded/installed and two Java clas has been created. You are going to use an XML file with a Java to create a CSV file with NSF data. Copy and paste below code to your environment, areas of interest have been highlighted for your convenience.




* @AppName: Docu.nsf

* Program:

* Created from Copy: 2012.

* Build Results into Console with CSV




* @author Dököll Solutions, Inc.

* @version 2012.



import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;


//Start of Program

public class ReadCSVFileBean



//Button code

public static void doGetCSVConsoleData()



//Entering try catch



// load the driver into memory


// create a connection. The first command line parameter is assumed to

// be the directory in which the .csv files are held

Connection conn = DriverManager.getConnection("jdbc:relique:csv:C:\\temp\\CSV_DATA\\");

// create a Statement object to execute the query with


//TO DO: Attempt using Prepared Statement here...

Statement stmt = conn.createStatement();

// Select* from UserNewLineOutboundInformation.csv

ResultSet results = stmt.executeQuery("SELECT * FROM UserNewLineOutboundInformation");

// dump out the results

while (


//TO DO: Write a separate JavaBean to build setters for variables

//that can used in Xpages...

String SiteName = results.getString("SiteName");

String SiteNumber = results.getString("SiteNumber");

//Load to Console

System.out.println("SiteName " + " SiteNumber");

System.out.println(SiteName + " " + SiteNumber);


// clean up





catch(Exception e)




}//end of program...


Build Xpage file

Full code added below, jump ahead if necessary, areas of interest have been highlighted for your convenience.


<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="">

<xp:link escape="true" id="link4"

style="text-align:center;background-position:center center;width:88.0px">

<xp:eventHandler event="onclick"

submit="true" refreshMode="complete" immediate="false"

save="true" id="eventHandler2">

<xp:image style="width:270.0px;height:170.0px;hspace:10.0px;align:center" id="image3" url="http://localhost/FileBin.nsf/DepartmentInventory.jpg"/>





You can now build CSV files from XML, data that can be used by your application in the making of charts and other types of reports. This could be a good way to use SQL to perform queries against this file and attempt other tasks

VTIP: You will need to reference in your faces-config.xml file. Also, this item can be used with a current XML creation from URL sample loaded prior.


Questions, comments, please post a brief message on our Contact form on the main site. Thank you for coming...