|
I have a text file named data.txt and the data inside are following:
Name,age,address,
xxx,17,ssssssssss,
yyy,29,qqqqqqqqqq,
zzz,24,tttttttttt,
I need to store it into mySQL, using JSP and/or Java.
In JSP
First field (row 0, column 1) : Name
Second field (row 0, column 2) : age
Third field (row 0, column 3) : address
(row 1, column 1) : xxx
(row 1, column 2) : 17
(row 1, column 3) : ssssssssss
(row 2, column 1) : yyy
(row 2, column 2) : 129
(row 2, column 3) : qqqqqqqqqq
(row 3, column 1) : zzz
(row 3, column 2) : 24
(row 3, column 3) : tttttttttt
And then store it in mySQL.
----------------------------------------------------
| | Name | age | address |
----------------------------------------------------
| 1 | xxx | 17 | ssssssssss |
----------------------------------------------------
| 2 | yyy | 29 | qqqqqqqqqq |
----------------------------------------------------
| 3 | zzz | 24 | tttttttttt |
----------------------------------------------------
I could find the java code on internet but just don't know how to write java code in JSP.
I'm using Eclipse and need to upload the text file to JSP first, but I can't read the text file(error: cannot be resolve).
Can anyone provide the code and brief explainations?
|