Hi All,
I try to upload one CSV file from
JSP and read in my Action Class and store in DB. While im doing that im getting error like "java.util.NoSuchElementException." and this error im getting while reading first line. still it didnt go to end of the first line.
If anyone having sample code please post it here.
FormFile myFile = myForm.getThefile();
String contentType = myFile.getContentType();
String fileName = myFile.getFileName();
int fileSize = myFile.getFileSize();
byte[] fileData = myFile.getFileData();
bcuz i couldnt attach either .CSV or .TXT, here im posting my file details:
account.main_card, account.name, account.agreement_status, account.cycle_day, account.trn_balance.date, account.trn_balance.amt, account.last_statement_date, account.last_statement_amt, account.phone.mobile, account.phone.home, account.phone.permanent, account.phone.fax, account.phone.office, account.opening_date, account.cancel_date, account.total_min_pyt, account.credit_limit, account.current, account.days_x, account.days_30, account.days_60, account.days_90, account.days_120, account.days_150, account.days_180, account.days_210, account.old_ic, account.ic, account.employer, account.address.home.address, account.address.home.address2, account.address.home.postcode, account.address.home.city, account.address.home.state, account.address.alternate.address, account.address.alternate.address2, account.address.alternate.postcode, account.address.alternate.city, account.address.alternate.state, account.address.other.address, account.address.other.address2, account.address.other.postcode, account.address.other.city, account.address.other.state, account.address.mail.address, account.address.mail.address2, account.address.mail.postcode, account.address.mail.city, account.address.mail.state, account.comm_rate, account.abort_date, account.overdue_min_pyt, account.total_due, account.last_collection_date, account.due_date, account.product_code
4509200001383896,ALEXANDER BEH BOON HOCK,15,23,,8881.43,23-07-2009,8893.99,0162626264,0392850936,,,0342962626,,,,0.00,0.00,0.00,820.00,0.00,0.00,0.00,0.00,0.00,0.00,,830222075343,C/O ALEXANDER BEH BOON HOCK FIRST IMPRESSION TRAVEL & TOURS SB ,17 LORONG BURUNG BAYAN 2,TAMAN BUKIT MALURI,52100,KUALA LUMPUR,WILAYAH PERSEKUTUAN ,,,,,,C/O ALEXANDER BEH BOON HOCK FIRST IMPRESSION TRAVEL & TOURS SB ," AY-2-8 AYERS TOWER JLN KOSAS UTAMA ,TAMAN KOSAS",68000,AMPANG,SELANGOR,17 LORONG BURUNG BAYAN 2,TAMAN BUKIT MALURI,52100,KUALA LUMPUR,WILAYAH PERSEKUTUAN ,14%,24-08-2009,1470.00,2095.00,23-08-2009,,PC30
5218870000188436,BEK THIAM LEONG,15,25,,5391.79,25-07-2009,5391.79,0162226606,0389442793,,,0389613866,,,,0.00,0.00,0.00,257.00,251.00,0.00,0.00,0.00,0.00,0.00,7336887,640529107875,C/O BEK THIAM LEONG SPEED DIMENSION (M) SDN BHD ,NO 3 JALAN PP 8,"TAMAN PINGGIRAN PUTRA ,SEKSYEN 2",43300,SERI KEMBANGAN,SELANGOR,NO 3 JALAN PP 8,TAMAN PINGGIRAN PUTRA SEKSYEN 2,43300,SERI KEMBANGAN,SELANGOR,C/O BEK THIAM LEONG SPEED DIMENSION (M) SDN BHD , LOT 6594 KAW PERINDUSTRIAN KG BARU BALAKONG,43300,SERI KEMBANGAN,,NO 3 JALAN PP 8,"TAMAN PINGGIRAN PUTRA ,SEKSYEN 2",43300,SERI KEMBANGAN,SELANGOR,14%,26-08-2009,772.00,1042.00,25-08-2009,,PC60
4509190000487212,CH'NG KIAN YONG,15,18,,8088.08,18-07-2009,8093.79,0123698608,069533458,,,,,,,0.00,0.00,0.00,892.00,0.00,0.00,0.00,0.00,0.00,0.00,A2687516,740410016173,,457 JALAN SRI 26,TAMAN SRI BAKRI 3,84200,MUAR,JOHOR,457 JALAN SRI 26,TAMAN SRI BAKRI 3,84200,MUAR,JOHOR,,,,,,457 JALAN SRI 26,TAMAN SRI BAKRI 3,84200,MUAR,JOHOR,14%,19-08-2009,1529.00,2145.00,18-08-2009,,PC30
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Note: i inserted one line space for each line for clarity, but in actual file there is no space like that.
thank you in advance,
kishore
[AG: edited a line that was screwing the layout]