MINI-PROJECT REPORT
Name of Students: Sandeep Tompe
Roll No:TITA57
Name of Mini-project: Develop a swing based college student management MVC pattern-based
application for college to manage students record.
Objectives:
▪ To understand about basic concept of AWT and SWING.
▪ To understand use of MySQL database
▪ To understand concept of Tomcat server.
▪ To make a swing based college student management system.
Methodology of Mini-project:
1) Theory: Consider a scenario of a school where everyday teachers, staff, authorities need to
go through the records of their students for various purposes like searching for a particular
student’s details. Manually going through records is a tedious job and also time-consuming.
Hence, it is better to develop in-school software that allows users to insert, update, search,
or delete records without manually going through documents every time a query arises.
JDBC API: Java Database Connectivity Application Program Interface is a set of interfaces
and classes using which you can write Java programs for accessing and manipulating
databases. It acts as a communication between the application and the database.
JDBC Driver: It enables a Java application to interact with the database. We need to set up
different JDBC drivers for different databases.
Features of the swing based college student management MVC pattern-based application
for college to manage students record.
• Improves students’ overall performance: Monitoring your pace is one of the mantras for
improving academic achievement. As a result, with the aid of school administration
software, students may focus their time on academics and other chores rather than keeping
track of their performance, which is handled by SMS software.
• It assists in the streamlining of all tasks: It was previously difficult for instructors to keep
track of all the activities and assignments assigned to each student, which were occasionally
neglected. However, thanks to school administration software, life has gotten much more
manageable. Teachers may simply manage, monitor, and track the performance of each
student using its efficient dashboard, and finally take suitable actions to finish it.
• Better Communication: When a teacher provides a lesson during a physical batch, it is
possible that some pupils will not fully get the topic and may ask questions. However, with
such power, it becomes hard for pupils to solve their problems.
• Available to all Parents: Parents are also pleased with the Student Management System
software since it was previously difficult for them to keep track of their child’s day-to-day
school activities or how they performed on in-class examinations or exams. However, owing
to this open-source software, parents can now access and easily monitor their children’s
performance and continuing school activities, such as homework, project submission,
attendance, and so on.
• Assists in keeping track of all students: In addition to academics, the school supervises
entire personality development, which includes athletics, recitation, music, dance, aerobics,
swimming, and so on. The Software Management System maintains track of and documents
extracurricular activities, ensuring that each student’s record is complete.
• Reduced Human Labor, Paperwork, and Workload: Employing employees to direct all of the
School’s day-to-day events is an additional cost that might be readily reduced by deploying
this new open-source administration management system. It also reduces the need for
written documents, human mistakes, and the workload of workers.
Steps for connecting the databases
1. Connection Class: It acts as a connection session between the Java program and specific
database application. It is through which we send SQL queries to the database.
2. Statement Class: A Statement is an interface that represents a SQL statement.
3. ResultSet: When you execute Statement objects, and they generate ResultSet objects, which
is a table of data representing a database result set. A Connection object is needed to create
a Statement object.
4. JDBC Driver Registration: To open a connection to the database from Java application, the
JDBC driver should be registered with the Device Manager. Hence we use forName() of
language package. Here com.mysql.jdbc.Driver is the driver name for MySQL.
5. .getConnection(): It is used to establish a physical connection to the database by specifying
the database name(student) , username(root) and password(root). This creates a connection
object.
6. Query Execution: createStatement() creates a statement type object that holds SQL queries.
Then executeQuery/executeUpdate method executes the SQL statement. Here it is “INSERT
INTO RECORD VALUES….”.
7. Data Extraction: The above method creates a resultset object that contains the resultant
data. (Now see the code below) rs is the variable that stores the resultant dataset and hence
we use a .get<Type>() method to obtain data.
8. while(rs.next()): (See code below) Since we need data containing multiple rows, we use a
loop to access them. The next() method moves the cursor forward by one row.
9. Closing open databases: We close all open databases to clean up the environment. Thus we
use- rs.close() , stmt.close() and con.close() methods.
2) In this article, we will see how to quickly create an application using Java Swing to perform
operations like create, retrieve, and delete into the database using JDBC.
Hardware Requirements: windows 11
Software Requirements: Eclipse, Apache tomcat 9 or later, MySQL Database, web Browser etc.
Execution Steps:
▪ Design html & JSP files to execute web application.
▪ Write database connection page wring servlet. set MySQL username, passwords and
database name in database connection page
▪ start the tomcat server with port number.
▪ Open the browser and type localhost: 8084
Program Code:
1. Student Management
Student.java
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import javax.swing.*;
public class Student implements ActionListener {
JFrame Frame;
JLabel title, name, id, age, address, classs, ph_no;
JTextField Title, Name, Id, Age, Address, Classs, Ph_no;
JButton Add, Search, Update, Delete, Exit,Clear;
public Student() {
Frame = new JFrame("MyFrame");
Frame.setVisible(true);
Frame.setLayout(null);
Color clr = new Color(128, 72, 156);
Frame.getContentPane().setBackground(clr);
title = new JLabel("STUDENT MANAGEMENT SYSTEM");
title.setBounds(100, 50, 700, 50);
title.setForeground(Color.WHITE);
title.setFont(new Font("Times New Roman", Font.BOLD, 25));
Frame.add(title);
id = new JLabel("ID");
id.setBounds(50, 200, 150, 50);
id.setForeground(Color.WHITE);
id.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(id);
name = new JLabel("Name");
name.setBounds(50, 250, 150, 50);
name.setForeground(Color.WHITE);
name.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(name);
age = new JLabel("Age");
age.setBounds(50, 300, 150, 50);
age.setForeground(Color.WHITE);
age.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(age);
address = new JLabel("Address");
address.setBounds(50, 350, 150, 50);
address.setForeground(Color.WHITE);
address.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(address);
classs = new JLabel("Class");
classs.setBounds(50, 400, 150, 50);
classs.setForeground(Color.WHITE);
classs.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(classs);
Id = new JTextField();
Id.setBounds(250, 200, 150, 30);
Id.setBackground(Color.white);
// ID.setForeground(Color.black);0
Frame.add(Id);
Name = new JTextField();
Name.setBounds(250, 250, 150, 30);
Name.setForeground(Color.black);
Name.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Name);
Age = new JTextField();
Age.setBounds(250, 300, 150, 30);
Age.setForeground(Color.BLACK);
Age.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Age);
Address = new JTextField();
Address.setBounds(250, 350, 150, 30);
Address.setForeground(Color.BLACK);
Address.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Address);
Classs = new JTextField();
Classs.setBounds(250, 400, 150, 30);
Classs.setForeground(Color.BLACK);
Classs.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Classs);
Add = new JButton("Add");
Add.setBackground(Color.GREEN);
Add.setForeground(Color.white);
Add.setBounds(50, 450, 80, 30);
Add.addActionListener(this);
Frame.add(Add);
Search = new JButton("Search");
Search.setBackground(Color.ORANGE);
Search.setForeground(Color.white);
Search.setBounds(150, 450, 80, 30);
Search.addActionListener(this);
Frame.add(Search);
Update = new JButton("Update");
Update.setForeground(Color.white);
Update.setBackground(Color.black);
Update.addActionListener(this);
Update.setBounds(250, 450, 80, 30);
Frame.add(Update);
Delete = new JButton("Delete");
Delete.setBackground(Color.BLUE);
Delete.setForeground(Color.white);
Delete.addActionListener(this);
Delete.setBounds(350, 450, 80, 30);
Frame.add(Delete);
Clear = new JButton("Clear");
Clear.setBackground(Color.white);
Clear.setForeground(Color.black);
Clear.setBounds(450, 450, 80, 30);
Clear.addActionListener(this);
Frame.add(Clear);
Exit = new JButton("Exit");
Exit.setBackground(Color.RED);
Exit.setForeground(Color.white);
Exit.setBounds(550, 450, 80, 30);
Exit.addActionListener(this);
Frame.add(Exit);
Frame.pack();
Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Frame.setVisible(true);
Frame.setResizable(false);
Frame.setSize(700, 600);
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String stud_id = Id.getText().toString();
String Stud_name = Name.getText().toString();
String stud_age = Age.getText().toString();
String Stud_address = Address.getText().toString();
String stud_class = Classs.getText().toString();
Conn c = new Conn();
if (e.getSource() == Add) {
int res = c.add(stud_id, Stud_name, stud_age, Stud_address,
stud_class);
if (res != 0) {
JOptionPane.showMessageDialog(Frame, "Record Added..");
} else {
JOptionPane.showMessageDialog(Frame, "Record Already
Exists....");
} else if (e.getSource() == Search) {
if (stud_id.equals("")) {
JOptionPane.showMessageDialog(Frame, "Please Provide
Student id");
} else {
try {
ResultSet rs = c.search(stud_id);
if (rs.next()) {
Id.setText(rs.getString("Id"));
Name.setText(rs.getString("Name"));
Age.setText(rs.getString("Age"));
Address.setText(rs.getString("Address"));
Classs.setText(rs.getString("Class"));
} else {
JOptionPane.showMessageDialog(Frame, "No
Records Found...");
} catch (Exception ex) {
JOptionPane.showMessageDialog(Frame, "Error
Occurd...");
} else if (e.getSource() == Update) {
if (stud_id.equals("")) {
JOptionPane.showMessageDialog(Frame, "Please Provide
Student id");
} else {
int res = c.update(stud_id, Stud_name, stud_age, Stud_address,
stud_class);
if (res != 0) {
JOptionPane.showMessageDialog(Frame, res + "
Records updated..");
} else {
JOptionPane.showMessageDialog(Frame, "No ID
Found....");
} else if (e.getSource() == Delete) {
if (stud_id.equals("")) {
JOptionPane.showMessageDialog(Frame, "Please Provide
Student id");
} else {
int res = c.delete(stud_id);
if (res != 0) {
JOptionPane.showMessageDialog(Frame, "Record
Deleted..");
} else {
JOptionPane.showMessageDialog(Frame, "ID Not
Found....");
}}
else if (e.getSource() == Clear) {
Name.setText("");
Id.setText("");
Age.setText("");
Address.setText("");
Classs.setText("");
else if (e.getSource() == Exit) {
System.exit(-1);
public static void main(String[] args) {
new Student();
Conn.java
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import javax.swing.*;
public class Student implements ActionListener {
JFrame Frame;
JLabel title, name, id, age, address, classs, ph_no;
JTextField Title, Name, Id, Age, Address, Classs, Ph_no;
JButton Add, Search, Update, Delete, Exit,Clear;
public Student() {
Frame = new JFrame("MyFrame");
Frame.setVisible(true);
Frame.setLayout(null);
Color clr = new Color(128, 72, 156);
Frame.getContentPane().setBackground(clr);
title = new JLabel("STUDENT MANAGEMENT SYSTEM");
title.setBounds(100, 50, 700, 50);
title.setForeground(Color.WHITE);
title.setFont(new Font("Times New Roman", Font.BOLD, 25));
Frame.add(title);
id = new JLabel("ID");
id.setBounds(50, 200, 150, 50);
id.setForeground(Color.WHITE);
id.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(id);
name = new JLabel("Name");
name.setBounds(50, 250, 150, 50);
name.setForeground(Color.WHITE);
name.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(name);
age = new JLabel("Age");
age.setBounds(50, 300, 150, 50);
age.setForeground(Color.WHITE);
age.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(age);
address = new JLabel("Address");
address.setBounds(50, 350, 150, 50);
address.setForeground(Color.WHITE);
address.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(address);
classs = new JLabel("Class");
classs.setBounds(50, 400, 150, 50);
classs.setForeground(Color.WHITE);
classs.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(classs);
Id = new JTextField();
Id.setBounds(250, 200, 150, 30);
Id.setBackground(Color.white);
// ID.setForeground(Color.black);0
Frame.add(Id);
Name = new JTextField();
Name.setBounds(250, 250, 150, 30);
Name.setForeground(Color.black);
Name.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Name);
Age = new JTextField();
Age.setBounds(250, 300, 150, 30);
Age.setForeground(Color.BLACK);
Age.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Age);
Address = new JTextField();
Address.setBounds(250, 350, 150, 30);
Address.setForeground(Color.BLACK);
Address.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Address);
Classs = new JTextField();
Classs.setBounds(250, 400, 150, 30);
Classs.setForeground(Color.BLACK);
Classs.setFont(new Font("Times New Roman", Font.PLAIN, 18));
Frame.add(Classs);
Add = new JButton("Add");
Add.setBackground(Color.GREEN);
Add.setForeground(Color.white);
Add.setBounds(50, 450, 80, 30);
Add.addActionListener(this);
Frame.add(Add);
Search = new JButton("Search");
Search.setBackground(Color.ORANGE);
Search.setForeground(Color.white);
Search.setBounds(150, 450, 80, 30);
Search.addActionListener(this);
Frame.add(Search);
Update = new JButton("Update");
Update.setForeground(Color.white);
Update.setBackground(Color.black);
Update.addActionListener(this);
Update.setBounds(250, 450, 80, 30);
Frame.add(Update);
Delete = new JButton("Delete");
Delete.setBackground(Color.BLUE);
Delete.setForeground(Color.white);
Delete.addActionListener(this);
Delete.setBounds(350, 450, 80, 30);
Frame.add(Delete);
Clear = new JButton("Clear");
Clear.setBackground(Color.white);
Clear.setForeground(Color.black);
Clear.setBounds(450, 450, 80, 30);
Clear.addActionListener(this);
Frame.add(Clear);
Exit = new JButton("Exit");
Exit.setBackground(Color.RED);
Exit.setForeground(Color.white);
Exit.setBounds(550, 450, 80, 30);
Exit.addActionListener(this);
Frame.add(Exit);
Frame.pack();
Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Frame.setVisible(true);
Frame.setResizable(false);
Frame.setSize(700, 600);
Output:
Conclusion: In this way, we have successfully designed web applications using JSP, Servlet and
MySQL server.