Share
Go down
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

logging invalid inputs in a file

on Tue Jan 29, 2013 3:37 pm
hi everyone,
i have a code in js which accepts inputs from json values and fills a form repeatedly(i looped it for a no. of inputs set).the form skips the invalid inputs and moves on but i want these invalid inputs to be stored somewhere.can anyone help me?
adityac
Professional
Professional
Posts : 101
Join date : 2013-01-17

Re: logging invalid inputs in a file

on Tue Jan 29, 2013 6:05 pm
u want to store it in excel ???
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

Re: logging invalid inputs in a file

on Wed Jan 30, 2013 11:33 am
any file.............even text file will do
adityac
Professional
Professional
Posts : 101
Join date : 2013-01-17

Re: logging invalid inputs in a file

on Wed Jan 30, 2013 4:02 pm
i tried same in java n i exported to excel... bt scenario wat i tried is generated code and result of code will be send to excel....if u requred i will paste the code..
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

Re: logging invalid inputs in a file

on Thu Jan 31, 2013 11:16 am
ya sure ....paste it please Smile!!!!!!
adityac
Professional
Professional
Posts : 101
Join date : 2013-01-17

Re: logging invalid inputs in a file

on Thu Jan 31, 2013 2:34 pm

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
/*poi*/
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class ExcelExporting {

public int int1;
public int writeExcelFile(String fileName) {
FileOutputStream fileOutputStream = null;
HSSFWorkbook sampleWorkbook = null;
HSSFSheet sampleDataSheet = null;
try {


sampleWorkbook = new HSSFWorkbook();
sampleDataSheet = sampleWorkbook.createSheet();

HSSFRow headerRow = sampleDataSheet.createRow(0);
HSSFRow dataRow1 = sampleDataSheet.createRow(1);

Random randomGenerator = new Random();
int1=randomGenerator.nextInt(9000000)+1000000;
System.out.println("Number is:"+ int1);

HSSFCell firstHeaderCell = headerRow.createCell(0);

firstHeaderCell.setCellValue(new HSSFRichTextString("RN"));

dataRow1.createCell(0).setCellValue(
new HSSFRichTextString(""+int1));
fileOutputStream = new FileOutputStream(fileName);
sampleWorkbook.write(fileOutputStream);
} catch (Exception ex) {
System.out.println(ex);
} finally {

try {
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (IOException ex) {
System.out.println(ex);
}
}
return int1;
}

public static int Export(){
int int2 = new ExcelExporting().writeExcelFile("G:\\Excel\\Excel2.xls"); /*this method will return int1 value and we are assigning to int2 */
return int2;
}

}


This might help u....
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

Re: logging invalid inputs in a file

on Fri Feb 01, 2013 11:08 am
hey i tried your code in eclipse but it gives error saying HSSFWorkbook,HSSFSheet, HSSFRow,HSSFCell, HSSFRichTextString do cannot be resolved to a type and the available fixes ask for creating a class of the respective type........................do i need to import some file or declare any variable? Question
adityac
Professional
Professional
Posts : 101
Join date : 2013-01-17

Re: logging invalid inputs in a file

on Fri Feb 01, 2013 11:37 am
yes u need to add poi jar for tht....
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

Re: logging invalid inputs in a file

on Fri Feb 01, 2013 12:53 pm
k.....thanks...can you tell me a link to download these jar files?
adityac
Professional
Professional
Posts : 101
Join date : 2013-01-17

Re: logging invalid inputs in a file

on Fri Feb 01, 2013 3:24 pm
Poonam12031990
Active particpant
Active particpant
Posts : 18
Join date : 2013-01-29

Re: logging invalid inputs in a file

on Fri Feb 01, 2013 4:25 pm
thanks!!!!!!!!!!!!!!!! will check it out...........
Sponsored content

Re: logging invalid inputs in a file

Back to top
Permissions in this forum:
You cannot reply to topics in this forum