0

hi all

i need to make a upload option for user to upload .csv file using jsp then i have to read the .csv file and validate it. if i validation of row is correct then i have update in database else i have to show the error to the user with corresponding row highlighted.

can any one help me out

thanks

mushtaq

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by patelakhil
0

hi all

i need to make a upload option for user to upload .csv file using jsp then i have to read the .csv file and validate it. if i validation of row is correct then i have update in database else i have to show the error to the user with corresponding row highlighted.

can any one help me out


thanks

mushtaq

Yeah I am also having similar requirement.Can anyone give me a hint on this

Thanks in Advance

-1

Hi,

While you upload than you have to read that from request form object and after that you can save CSV any where on server. After that following code will help you for reading CSV in JSP

String filePathOnServer= application.getRealPath("main.csv"); //here main.csv in root folder.

 FileInputStream fis = new FileInputStream(filePathOnServer);
 DataInputStream dis = new DataInputStream(fis);

//Following code may required some tweaking because I have used readLine() in different manner.
while(dis.readLine())
{
      //Split the line and assign to array than validate and save to db
      //Here you can use class object for each line
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.