Download presentation
Presentation is loading. Please wait.
Published byDwain Park Modified over 9 years ago
1
Import Data From Excel File into Database
2
Contents 1.Understanding Excel structure 2.Understanding jxl.jar library 3.Problem: Import student information from Excel File 4.Solution
3
1. Understand Excel structure One Excel File data store in a workbook Each workbook contents a lot of sheets Each sheet contents a lot of rows Each row contents a lot of cells Cell contents the data
4
Workbook Object Workbook Object Sheet Object Sheet Object Cell Object Cell Object Reference: http://jexcelapi.sourceforge.net/ http://jexcelapi.sourceforge.net/ 2. Understanding jxl.jar library
5
3. Problem: Import student information from Excel File There is a list of students information in excel file. See the picture bellow:
6
Write a program read all students information and then store it into your database. Write a jsp file to view all students information stored in the database
7
Sample Interface
9
4. Solution 4.1 Analysis and design database to store student information 4.2 Coding
10
4.1 Analysis and design database to store student information Each student object include student id, first name, last name, and gender. Create a database name “iwp” and then create student table to store student information include fields: 1. Student ID (Primary key) 2. Last Name 3. First Name 4. Gender
12
Step 1: Copy upload file bean and jxl.jar library to web server Step 2: Write code 4.1 Coding
13
Step 1: Copy upload file bean class and jxl.jar library Copy com package to tomcat install_dir/webapps/ROOT/WEB-INF/class using for upload file from client to Server Copy jxl.jar library to tomcat install_dir/webapps/ROOT/WEB-INF/lib using for read excel filejxl.jar
14
a. Developing importstudentinformation.jsp to upload excel file from client to server and then read student information from excel to store into database b. Developing listofstudents.jsp to view all students in student table Step 2: Write code
15
a. Upload excel file and read data – importstudentinformation.jsp
21
b. Developing listofstudents.jsp
24
References http://jexcelapi.sourceforge.net/ http://oms.saigontech.edu.vn
25
Practice Exercise Import the list of employees in excel file and create a jsp file to view all employees stored in database.
26
Practice Exercise 1 We have a list of courses (Each course includes ID, Name, Credit). To prepares for student register class of each semester. AAS program director will decide list of courses will be offered in the next semester. Design database to store list of course will be offered for the each semester. Create a jsp file allow the program directors select courses will be offer.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.