JAVA
JAVA
JAVA
Laboratory Manual
(Advanced JAVA Programming)
4351603
Information Technology 5th Semester
Enrollment No.
Name
Branch
Academic Term
Institute
DTE’s Vision:
● To provide globally competitive technical education;
● Remove geographical imbalances and inconsistencies;
● Develop student friendly resources with a special focus on girls’ education
and support to weaker sections;
● Develop programs relevant to industry and create a vibrant pool of technical
professionals.
DTE’s Mission:
Institute’s Vision:
Institute’s Mission:
Department’s Vision:
Department’s Mission:
Advanced JAVA Programming (4351603)
Certificate
Place:…………………..
Date: …………………..
Preface
The primary aim of any laboratory/Practical/field work is enhancement of required skills as well
as creative ability amongst students to solve real time problems by developing relevant competencies in
psychomotor domain. Keeping in view, GTU has designed competency focused outcome-based
curriculum -2021 (COGC-2021) for Diploma engineering programmes. In this more time is allotted to
practical work than theory. It shows importance of enhancement of skills amongst students and it pays
attention to utilize every second of time allotted for practical amongst Students, Instructors and Lecturers
to achieve relevant outcomes by performing rather than writing practice in study type. It is essential for
effective implementation of competency focused outcome- based Green curriculum-2021. Every
practical has been keenly designed to serve as a tool to develop & enhance relevant industry needed
competency in each and every student. These psychomotor skills are very difficult to develop through
traditional chalk and board content delivery method in the classroom. Accordingly, this lab manual has
been designed to focus on the industry defined relevant outcomes, rather than old practice of conducting
practical to prove concept and theory.
By using this lab manual, students can read procedure one day in advance to actual performance
day of practical experiment which generates interest and also, they can have idea of judgement of
magnitude prior to performance. This in turn enhances predetermined outcomes amongst students. Each
and every Experiment /Practical in this manual begins by competency, industry relevant skills, course
outcomes as well as practical outcomes which serve as a key role for doing the practical. The students
will also have a clear idea of safety and necessary precautions to be taken while performing experiments.
This manual also provides guidelines to lecturers to facilitate student-centered lab activities for
each practical/experiment by arranging and managing necessary resources in order that the students
follow the procedures with required safety and necessary precautions to achieve outcomes. It also gives
an idea of how students will be assessed by providing Rubrics.
This course provides the knowledge necessary to develop dynamic web pages using Servlet, JSP,
MVC web frameworks and hibernate. It covers the basic underlying concepts and techniques recently
used in the IT industry. After going through this course students will be able to design MVC based
Web applications.
Although we try our level best to design this lab manual, there are always chances of
improvement. We welcome any suggestions for improvement.
3 | Page
Advanced JAVA Programming (4351603)
7. Life-long learning: Ability to analyze individual needs and engage in updating in the
context of technological changes in field of engineering.
4 | Page
Advanced JAVA Programming (4351603)
1.
Develop a GUI program by using
one swing button and adding it
√ - - - -
on the JFrame object
2.
Develop a program to create
checkboxes for different courses
belonging to a university such
that the course selected would √ - - - -
be displayed.
3.
Develop a program to Implement
Traffic signal(Red, Green and
Yellow) by using Swing
components ( Using JFrame, √ - - - -
JRadioButton, ItemListener etc.)
5 | Page
Advanced JAVA Programming (4351603)
6 | Page
Advanced JAVA Programming (4351603)
7 | Page
Advanced JAVA Programming (4351603)
1. Organize the work in the group and make a record of all observations.
2. Students shall develop maintenance skills as expected by industries.
3. Students shall attempt to develop related hand-on skills and build
confidence.
4. Students shall develop the habits of evolving more ideas, innovations, skills
etc.
5. Students shall refer to technical magazines and data books.
6. Students should develop the habit to submit the practical on date and time.
7. Students should prepare well while submitting a write-up of exercise.
8 | Page
Advanced JAVA Programming (4351603)
1
Develop a GUI program by using one swing button and
adding it on the JFrame object
2
Develop a program to create checkboxes for different
courses belonging to a university such that the course
selected would be displayed.
5
Develop a program using JDBC to edit (insert, update,
delete) Student’s profile stored in the database
7
Develop a simple servlet program which maintains a
counter for the number of times it has been accessed
since its loading; initialize the counter using
deployment descriptor.
9 | Page
Advanced JAVA Programming (4351603)
8
Create a web form which processes servlet and
demonstrates use of cookies and sessions.
10
Develop a JSP web application to display student
monthly attendance in each subject of current
semester via enrollment number.
11
Develop a JSP web application to select shopping
products, buy any products and product billing page
using session management.
12
Develop a JSP program for student registration for
new admission in college and display stored data into
admin dashboard.
10 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a GUI program by using one swing button and adding it on the JFrame
No:1 object.
A. Objective: Understand Java Swing's JButton and JFrame objects and implement graphical
user interface (GUIs) for Java applications.
11 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
Java Swing: Java Swing is a set of GUI (Graphical User Interface) components and
related classes provided by Java to create rich and interactive user interfaces for
desktop applications. Swing is built on top of the Abstract Window Toolkit (AWT) and
offers a more extensive and customizable set of components compared to AWT. It
provides a platform-independent way to create graphical applications, as it is part of
the Java Standard Edition (Java SE) and works on various operating systems without
any modifications.
Swing components are lightweight and offer a consistent look and feel across different
platforms, ensuring that the GUI behaves similarly on Windows, macOS, Linux, and
other supported systems. Some of the key features and benefits of Swing include:
JFrame: JFrame is a class in Java Swing that represents a top-level window or frame in
a GUI application. It serves as the main container for other GUI components, such as
12 | Page
Advanced JAVA Programming (4351603)
buttons, labels, text fields, etc. JFrame provides the necessary functionality to create,
configure, and manage the application window.
1. Window Management: JFrame allows you to set the title, size, location, and
visibility of the window. You can also control how the window behaves when it's
closed, such as terminating the application or hiding the window.
2. Content Pane: JFrame has a content pane (an instance of JPanel) that acts as a
container for placing other Swing components. You can add components to the
content pane using the add() method.
3. Layout Management: JFrame uses a default BorderLayout by default, but you can
change the layout manager to any other available layout manager or implement a
custom layout to organize the components within the window.
4. Event Handling: JFrame can handle various events like window opening, closing,
resizing, etc. by using event listeners.
5. Icon and Image Management: JFrame allows you to set icons for the application
window, which appear in the title bar and taskbar/dock. Overall, using JFrame along
with other Swing components, you can create interactive and user-friendly desktop
applications with ease and flexibility in Java.
H. Experimental set up/ Program Logic-Flow chart:
N/A
I. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch
Software JAVA IDE Size
4
Web Browser Edge, Firefox, Chrome or similar
N. References / Suggestions
1. https://www.javatpoint.com/java-swing
2. https://docs.oracle.com/javase/tutorial/uiswing/start/index.html
3. https://www.javatpoint.com/java-jbutton
14 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
15 | Page
Advanced JAVA Programming (4351603)
Date: ……………
16 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
▪ JCheckBox()
● Creates an initially unselected checkbox button with
no text and no icon
▪ JCheckBox(Action a)
● Creates a checkbox where the properties are taken
from the Action supplied
▪ JCheckBox(Icon icon)
● Creates an initially unselected checkbox with an icon
▪ JCheckBox(String text)
● Creates an initially unselected checkbox with text
▪ JCheckBox(String text, Icon icon, boolean selected)
● Creates a checkbox with text and icon, and specifies
whether or not it is initially selected.
I. Resources/Equipment Required
17 | Page
Advanced JAVA Programming (4351603)
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch
Software JAVA IDE Size
4
Web Browser Edge, Firefox, Chrome or similar
18 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.javatpoint.com/java-jcheckbox
2. https://www.tutorialspoint.com/swing/swing_jcheckbox.htm
3. https://docs.oracle.com/javase/8/docs/api/javax/swing/JCheckBox.html
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
19 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a program to Implement Traffic signal(Red, Green and Yellow) by using
No:3 Swing components ( Using JFrame, JRadioButton, ItemListener etc.).
A. Objective: Understand and be able to use JFrame, JRadioButton, ItemListener etc in Java
applications.
20 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
21 | Page
Advanced JAVA Programming (4351603)
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch
Software JAVA IDE Size
4
Web Browser Edge, Firefox, Chrome or similar
22 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.javatpoint.com/java-jradiobutton
2. https://www.tutorialspoint.com/swing/swing_jradiobutton.htm
3. https://www.tutorialspoint.com/swing/swing_event_listeners.htm
4. https://www.javatpoint.com/java-itemlistener
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
Date: ……………
23 | Page
Advanced JAVA Programming (4351603)
Practical Develop a program using JDBC to display student’s record (Enroll No, Name,
No:4 Address, Mobile No,and Email-ID) into table ‘StuRec’.
A. Objective: Understand and apply the logic for connection between Java applications
with the database by using JDBC.
This practical is expected to develop the following skills for the industry identified
competency:
1. Download and install any one JDBC driver as per requirement.
2. Download database server.
3. Implement and run programs using any IDE.
G. Prerequisite Theory:
24 | Page
Advanced JAVA Programming (4351603)
❖ JDBC: JDBC stands for Java Database Connectivity. JDBC is a Java API to connect
and execute the query with the database. It is a part of JavaSE (Java Standard
Edition). JDBC API uses JDBC drivers to connect with the database. There are
four types of JDBC drivers
o JDBC-ODBC Bridge Driver,
o Native Driver,
o Network Protocol Driver, and
o Thin Driver
We can use JDBC API to access tabular data stored in any relational database.
By the help of JDBC API, we can save, update, delete and fetch data from the
database. It is like Open Database Connectivity (ODBC) provided by Microsoft.
Here are some essential components of JDBC
DriverManager: The central class in the JDBC API. It helps manage the drivers for
different database systems and provides methods to establish database connections.
Driver: A JDBC driver is a software component that enables Java applications to interact
with a specific database. Each database vendor provides its JDBC driver
implementation.
Statement: Used to execute SQL queries without parameters. You can create instances
of Statement from a Connection object.
ResultSet: Represents the result of a query execution. It allows you to iterate over the
rows returned by the query
There are 5 steps to connect any java application with the database using JDBC. These
steps are as follows:
o Import the required package
o Load and Register the Driver class
25 | Page
Advanced JAVA Programming (4351603)
o Create connection
o Create statement
o Execute queries
o Process the result
o Close connection
JDBC is widely used in Java-based applications that need to interact with databases,
and it provides a standard way to manage database connections across various
platforms and database systems
26 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.geeksforgeeks.org/introduction-to-jdbc/
2. https://www.tutorialspoint.com/jdbc/index.htm
3. https://www.javatpoint.com/steps-to-connect-to-the-database-in-java
4. https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/
27 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
28 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a program using JDBC to edit (insert, update, delete) Student’s profile
No:5 stored in the database.
A. Objective: Develop graphical user interfaces (GUIs) application using JDBC to insert,
update and delete any record in the database.
B. Expected Program Outcomes (POs)
Po1 - Basic and Discipline specific knowledge.
Po2 - Problem analysis.
Po3 - Design/ development of solutions.
Po4 - Engineering Tools, Experimentation and Testing.
Po6 - Project Management.
Po7 - Lifelong learning.
Students will be able to develop Java applications using JDBC to update the
database.
F. Expected Affective domain Outcome (ADos)
G. Prerequisite Theory:
1) public boolean next(): is used to move the cursor to the one row next
from the current position.
2) public boolean previous(): is used to move the cursor to the one row
previous from the current position.
30 | Page
Advanced JAVA Programming (4351603)
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch
Software JAVA IDE Size
4
Web Browser Edge, Firefox, Chrome or similar
NA
K. Source code:
L. Input-Output:
31 | Page
Advanced JAVA Programming (4351603)
1. https://www.javatpoint.com/Connection-interface
2. https://www.tutorialspoint.com/jdbc/jdbc-statements.htm
3. https://www.javatpoint.com/ResultSet-interface
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
32 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop an application to store, update, fetch and delete data of Employee
(NAME, AGE, SALARY and DEPARTMENT) using Hibernate CRUD
No:6 operations.
Students will be able to apply on the hibernate architecture to java web application
development.
F. Expected Affective domain Outcome (ADos)
33 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
2. Database Independence
3. Increased Productivity
4. Object-Relational Transparency
5. Performance Optimization
The Hibernate architecture can be divided into the following key components:
1. Application Layer: This layer represents the application code and the
domain model, which includes the Java classes that map to database tables. The
application layer interacts with Hibernate to perform various operations on the
database.
34 | Page
Advanced JAVA Programming (4351603)
9. Query Language Support: Hibernate provides its own query language called
Hibernate Query Language (HQL), which is a powerful and flexible language for
querying the database. HQL is similar to SQL but operates on object-oriented
35 | Page
Advanced JAVA Programming (4351603)
concepts instead of database tables and columns. Hibernate also supports the
Criteria API and native SQL queries for more complex query requirements.
❖ To set up Eclipse with Hibernate API, you can follow these steps:
• Install Eclipse: Download and install Eclipse IDE from the official Eclipse
website (https://www.eclipse.org/downloads/). Choose the version suitable for
your operating system and Java development needs.
• Create a Java Project: Open Eclipse and create a new Java project by
selecting "File" > "New" > "Java Project". Give your project a name and click
"Finish" to create the project.
• Add Hibernate Libraries: Download the Hibernate libraries (JAR files) from
the Hibernate website (https://hibernate.org/orm/releases/) or use a
dependency management tool like Maven. Copy the Hibernate JAR files to a
folder in your project, such as a "lib" folder.
Create Hibernate Mapping Files: Right-click on your project, select "New" >
"File". Enter a file name like "Employee.hbm.xml" and click "Finish". In the
mapping file, define the mappings between your Java classes and database
tables using the Hibernate mapping language. Repeat this step for each entity
you want to persist with Hibernate.
Start Coding with Hibernate: Begin coding your application using Hibernate
API. Import the necessary Hibernate classes and annotations into your Java
classes. Use the SessionFactory, Session, and Transaction APIs to perform
database operations like saving, updating, and querying objects.
36 | Page
Advanced JAVA Programming (4351603)
Run and Test: Once you have written your code, you can run and test your
Hibernate-enabled application. Make sure you have a database connection set
up and running, and that it aligns with the configuration specified in the
hibernate.cfg.xml file.
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch
Software JAVA IDE Size
4
Web Browser Edge, Firefox, Chrome or similar
NA
K. Source code:
37 | Page
Advanced JAVA Programming (4351603)
L. Input-Output:
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
38 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a simple servlet program which maintains a counter for the number of
times it has been accessed since its loading; initialize the counter using
No:7 deployment descriptors.
CO3: Develop Web Applications using Servlets and deploy in popular servers
like Tomcat.
39 | Page
Advanced JAVA Programming (4351603)
40 | Page
Advanced JAVA Programming (4351603)
41 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.javatpoint.com/servlet-tutorial
2. https://www.tutorialspoint.com/servlets/index.htm
3. https://www.geeksforgeeks.org/introduction-java-servlets/
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
42 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Create a web form which processes servlet and demonstrates use of cookies and
No:8 sessions.
CO3: Develop Web Applications using Servlets and deploy in popular servers
like Tomcat.
43 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
❖ Session Tracking: Session simply means a particular interval of time.
Session Tracking is a way to maintain the state (data) of an user. It is also
known as session management in servlet.
Http protocol is stateless so we need to maintain state using session
tracking techniques. Each time a user requests to the server, the server
treats the request as the new request. So we need to maintain the state of a
user to recognize a particular user. HTTP is stateless, which means each
request is considered as the new request.
❖ Cookies: Cookies are used a lot in web applications to personalize
responses based on your choice or to keep track of sessions. A cookie is a
small piece of information that is persisted between the multiple client
requests. A cookie has a name, a single value, and optional attributes such
as a comment, path and domain qualifiers, a maximum age, and a version
number.
There are 2 types of cookies in servlets:
44 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.ibm.com/docs/en/was/8.5.5?topic=SSEQTP_8.5.5/com.ibm.we
bsphere.nd.multiplatform.doc/ae/tprs_sesi.htm
2. https://www.javatpoint.com/session-tracking-in-servlets
3. https://www.javatpoint.com/http-session-in-session-tracking
4. https://www.geeksforgeeks.org/servlet-session-tracking/
5. https://www.digitalocean.com/community/tutorials/java-session-
management-servlet-httpsession-url-rewriting
45 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
R1 (3) (3)
R2 R3
46 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical
Develop a web form which processes servlet for user login functionality.
No:9
Students will be able to develop web applications using servlet and connect it
with databases.
47 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
❖ Servlet Database Access: Here we assume that you have an understanding
on how the JDBC application works. Before starting with database access
through a servlet, make sure you have a proper JDBC environment setup
along with a database server setup. For more detail on how to access
databases using JDBC you can go through JDBC practical theory.
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3 Batch Size
Software JAVA IDE
4
Web Browser Edge, Firefox, Chrome or
similar
48 | Page
Advanced JAVA Programming (4351603)
N. References / Suggestions
1. https://www.geeksforgeeks.org/servlet-database-access/
2. https://www.tutorialspoint.com/servlets/servlets-database-access.htm
49 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
R1 (3) (3)
R2 R3
50 | Page
Advanced JAVA Programming (4351603)
Date: ……………
A. Objective: JSP integrates well with other Java technologies, such as Java
Servlets and Java EE frameworks. It allows seamless communication with back-
end systems, databases, and other services using Java code.
B. Expected Program Outcomes (POs)
Po1 - Basic and Discipline specific knowledge.
Po2 - Problem analysis.
Po3 - Design/ development of solutions.
Po4 - Engineering Tools, Experimentation and Testing.
Po6 - Project Management.
Po7 - Lifelong learning.
G. Prerequisite Theory:
51 | Page
Advanced JAVA Programming (4351603)
9. View the JSP application: Eclipse will open a web browser, showing the
JSP application running locally on the server. You can interact with the JSP
page and test its functionality.
52 | Page
Advanced JAVA Programming (4351603)
I. Resources/Equipment Required
Sr. Instrument/Equipment
Specification Quantity
No.
/Components/Trainer kit
1 Hardware: Computer (i3-i5 preferable)
Computer System
2 Operating System Windows/ Linux/ MAC
As Per
3
Software JAVA IDE Batch
Size
4
Web Browser Edge, Firefox, Chrome or
similar
NA
K. Source code:
N. References / Suggestions
1) https://www.tutorialspoint.com/jsp/jsp_form_processing.htm
2) https://www.javatpoint.com/registration-form-in-jsp
3) https://dotnettutorials.net/lesson/jsp-form-processing/
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
R1 (3) (3)
R2 R3
54 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a JSP web application to select shopping products, buy any
No:11 products and product billing page using session management.
A. Objective: JSP session management is to maintain user sessions and store session-
specific data for personalized, stateful, and secure web interactions.
B. Expected Program Outcomes (POs)
Po1 - Basic and Discipline specific knowledge.
Po2 - Problem analysis.
Po3 - Design/ development of solutions.
Po4 - Engineering Tools, Experimentation and Testing.
Po6 - Project Management.
Po7 - Lifelong learning.
Students will be able to use JSP Application with session management and tracking
session data.
55 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
❖ To develop a JSP session management application, you can follow these steps:
56 | Page
Advanced JAVA Programming (4351603)
JAVA IDE
3 Software
K. Source code:
L. Input-Output:
N. References / Suggestions
1) https://www.w3schools.in/jsp/session
2) https://www.javatpoint.com/session-implicit-object
57 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
58 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a JSP program for student registration for new admission in
No:12 college and display stored data it into admin dashboard.
Students will be able to apply different JSP tags with the database.
59 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
❖ To create a JSP registration page with a database, you can follow these steps:
○ Set up Database: Create a database and the required table(s) to store user
registration data.
○ Create JSP Registration Page: Design a JSP page with form fields for user
registration, such as username, password, email, etc.
○ Establish Database Connection: Write Java code to establish a connection
with the database using JDBC (Java Database Connectivity).
○ Retrieve User Input: Capture user input from the registration form using JSP
or Java code.
○ Validate User Input: Validate the user input to ensure data integrity and
perform necessary checks, such as checking for duplicate usernames or
password strength.
○ Insert Data into the Database: Use SQL queries or prepared statements to
insert the user registration data into the database table.
○ Display Success/Failure Message: Based on the result of the database
operation, display a success or failure message on the JSP registration page.
○ Close Database Connection: Properly close the database connection to
release resources.
○ Test and Debug: Run the application and test the registration page by
entering user details. Verify if the data is successfully inserted into the
database.
○ Enhance Functionality: Add additional features as needed, such as email
verification, password encryption, or CAPTCHA for enhanced security.
60 | Page
Advanced JAVA Programming (4351603)
I. Resources/Equipment Required
JAVA IDE
3 Software
K. Source code:
L. Input-Output:
N. References / Suggestions
1) https://www.tutorialspoint.com/jsp/jsp_database_access.htm
2) https://www.javaguides.net/2019/01/jsp-jdbc-mysql-example.html
61 | Page
Advanced JAVA Programming (4351603)
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
62 | Page
Advanced JAVA Programming (4351603)
Date: ……………
Practical Develop a Web MVC Architecture based application to provide user Login
No:13 and Register using Spring Boot.
63 | Page
Advanced JAVA Programming (4351603)
G. Prerequisite Theory:
❖ To create a login and registration form using Spring Boot, you can follow these
steps:
● Set up Development Environment: Install Java Development Kit (JDK) and
your preferred IDE (e.g., Eclipse, IntelliJ IDEA) with Spring Boot support.
● Create a Spring Boot Project: Create a new Spring Boot project using your
IDE or the Spring Initializr (https://start.spring.io/). Include the necessary
dependencies for web, security, and database access.
● Design Login and Registration Forms: Design HTML forms for login and
registration, including input fields for username, password, email, etc. Use
Thymeleaf or any other templating engine supported by Spring Boot for
server-side rendering.
● Implement User Entity and Database Schema: Define a User entity class to
represent user data and create the corresponding database schema using
an ORM tool like Hibernate or Spring Data JPA.
● Implement User Service: Create a UserService class to handle user-related
operations, including user registration, authentication, and retrieval from
the database.
● Implement Controllers: Create Spring MVC controllers to handle HTTP
requests for login and registration. Map these requests to appropriate
methods in the controllers.
● Implement Registration Functionality: In the registration controller, validate
user input, create a new User object, and save it to the database using the
UserService.
● Implement Login Functionality: In the login controller, validate user
credentials, authenticate the user using Spring Security, and redirect to the
appropriate page based on the authentication result.
64 | Page
Advanced JAVA Programming (4351603)
I. Resources/Equipment Required
JAVA IDE
3 Software
K. Source code:
65 | Page
Advanced JAVA Programming (4351603)
L. Input-Output:
N. References / Suggestions
1)https://www.javaguides.net/2018/10/user-registration-module-using-
springboot-springmvc-springsecurity-hibernate5-thymeleaf-mysql.html
2)https://www.codejava.net/frameworks/spring-boot/user-registration-and-
login-tutorial
O. Assessment-Rubrics
Faculty
Marks Date
Signature
Obtained
66 | Page
Advanced JAVA Programming (4351603)
Branch Coordinator
Mr. Nandu Fatak
HOD(IT)
Government Polytechnic for Girls, Ahmedabad
Committee Chairman
Shri R. D. Raghani
(HOD-EC)
Principal (I/C)
Government Polytechnic, Gandhinagar
67 | Page