2. Download attached employee-form.zip
3. To run it in Eclipse: right-click employee-form → Run As → Run on Server → Tomcat v9.0. URLs will be:
http://localhost:8105/employee-form/ — index with all links
http://localhost:8105/employee-form/employeeregister.jsp— the form
4.
Forms and Session Management
Employee Registration using JSP form + Servlet + JDBC + MySQL, followed by
Servlet Session Management concepts.
Tools & Technologies (per PPT)
- JSP 2.2+
- STS / Eclipse Neon.3
- JDK 1.8+
- Apache Tomcat 8.5
- JSTL 1.2.1
- Servlet API 2.5
- MySQL
mysql-connector-java-8.0.13
Dependencies — WEB-INF/lib
jsp-api-2.3.1.jar
servlet-api-2.3.jar
mysql-connector-java-8.0.13.jar
jstl-1.2.jar
Development Steps
- File > New > Project… > Web > Dynamic Web Project
name =jsp-servlet-jdbc-mysql-example, runtime =Tomcat 8.5 - Add the dependencies
- Project structure
- MySQL database setup
Employee.java— JavaBeanEmployeeDao.java— JDBC codeEmployeeServlet.java— controlleremployeeregister.jsp— registration formemployeedetails.jsp— success page- Demo — deploy on Tomcat and submit the form
Database Steps
- Connect to mysql workbench database using Database >> Connect to database
User name is root (by default) and password is "system" - Create database and then the table with below command
CREATE DATABASE employees;
USE employees;
CREATE TABLE employee(
id int(3) NOT NULL AUTO_INCREMENT,
first_name varchar(20) DEFAULT NULL,
last_name varchar(20) DEFAULT NULL,
username varchar(250) DEFAULT NULL,
password varchar(20) DEFAULT NULL,
address varchar(45) DEFAULT NULL,
contact varchar(45) DEFAULT NULL,
PRIMARY KEY (id)
);
- 2. URL http://localhost:9090/employee-form/employeeregister.jsp
No comments yet.