Skip to Content
0
Former Member
Aug 31, 2006 at 09:39 AM

How to generate html-code using csv input with JSP or JAVA???

321 Views

Hello,

I want to read out a .csv-file and generate html-code dynmically with JSP in an EP6 Application. The problem is, that the csv-file can’t be located or openend.

BTW if every knows a good tutorial or weblog for this, please post the link.

It’s located in a par-archive under:

/>dist>files

I tried various methods, in the doContent mehtod or with JSP. Everytime same result.

Here part of the code I tried in the doContent():

public class CSV extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

String strWRoot = request.getWebResourcePath();

String contentCSV="", line="";

String linesep = System.getProperty("line.separator");

File fileLoadCSV = new File(strWRoot+"/files/ma_infosysteme.csv");

boolean exCSV = fileLoadCSV.exists();

boolean reCSV = fileLoadCSV.canRead();

int a=0;

if(exCSV&&reCSV){

response.write("ok");

try {

BufferedReader inputCSV = new BufferedReader(new FileReader(fileLoadCSV));

while((line=inputCSV.readLine())!=null){

contentCSV=contentCSVlinelinesep;

a++;

}

inputCSV.close();

}

catch(IOException ioex){

System.out.println("Fehler");

}

}

else {

response.write("not ok");

};

response.write("<br>Wroot: "+strWRoot);

response.write("<br>File: "+fileLoadCSV);

response.write("<br>exists: "+exCSV);

response.write("<br>read: "+reCSV);

response.write("<br>Input: "+contentCSV);

}

}

The Output is:

not ok

Wroot: /irj/portalapps/DHTML

File: \irj\portalapps\DHTML\files\ma_infosysteme.csv

exists: false

read: false

Input:

So thanks to everyone who can give me a good hint.

Bye.