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

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

Member Avatar for patelakhil

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
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.