Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

logging invalid inputs in a file

View previous topic View next topic Go down

logging invalid inputs in a file

Post by Poonam12031990 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?

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by adityac on Tue Jan 29, 2013 6:05 pm

u want to store it in excel ???

adityac
Professional
Professional

Posts : 101
Join date : 2013-01-17

Back to top Go down

Re: logging invalid inputs in a file

Post by Poonam12031990 on Wed Jan 30, 2013 11:33 am

any file.............even text file will do

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by adityac 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..

adityac
Professional
Professional

Posts : 101
Join date : 2013-01-17

Back to top Go down

Re: logging invalid inputs in a file

Post by Poonam12031990 on Thu Jan 31, 2013 11:16 am

ya sure ....paste it please Smile!!!!!!

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by adityac 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....

adityac
Professional
Professional

Posts : 101
Join date : 2013-01-17

Back to top Go down

Re: logging invalid inputs in a file

Post by Poonam12031990 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

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by adityac on Fri Feb 01, 2013 11:37 am

yes u need to add poi jar for tht....

adityac
Professional
Professional

Posts : 101
Join date : 2013-01-17

Back to top Go down

Re: logging invalid inputs in a file

Post by Poonam12031990 on Fri Feb 01, 2013 12:53 pm

k.....thanks...can you tell me a link to download these jar files?

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by adityac on Fri Feb 01, 2013 3:24 pm

http://www.jarfinder.com/index.php/jars/versionInfo/44527

adityac
Professional
Professional

Posts : 101
Join date : 2013-01-17

Back to top Go down

Re: logging invalid inputs in a file

Post by Poonam12031990 on Fri Feb 01, 2013 4:25 pm

thanks!!!!!!!!!!!!!!!! will check it out...........

Poonam12031990
Active particpant
Active particpant

Posts : 18
Join date : 2013-01-29

Back to top Go down

Re: logging invalid inputs in a file

Post by Sponsored content Today at 9:04 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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