So, basically what I want to do is, on a jsp page give option to browse and select an excel file. Then when the user clicks on Upload button, the data from excel is saved into database table.
I am able to insert into database table without the UI i.e., when there is only servlet and database. In that case, I am doing this:
InputStream fis = new FileInputStream(new File("C:\\Users\\RAJYAWARDHAN\\Desktop\\Book1.xlsx"));
And after this I use fis to one by one enter data into Database table using Apache POI. But when JSP page is included I am using form:
<input type="file" name="file_uploaded" />
So, when not using JSP page, I have the address of file, that is on my machine only. But that's for test purpose. When user will upload, then I will not have the address of the file because file is on users machine. Hence, I cannot use new File("address_of_file") as file is not on my machine(server basically).
Also, I don't want to first upload file from users machine to my machine and then pick it up from that particular path. I just want to import data from the selected file by user and not actually upload and save that file.
What should I do? Please explain in simple terms. Thank You.
Please ask if question is not clear. English is not my first language.