Search Medicine project in Java using JSP, Servlet, JDBC and MYSQL

The Online Search Medicine Project in Java is a web-based application developed using JSP, Servlet, JDBC, MySQL, Apache Tomcat, Maven, HTML, CSS, Bootstrap, and JavaScript. The application allows users to search for medicines, view available medicines, and book medicines online.

This is a J2EE and Maven-based project that follows the MVC (Model-View-Controller) architecture. The application runs in a web browser and can be deployed on the Apache Tomcat server.

The project is useful for students who want to learn how to develop a Java web application using JSP, Servlet, JDBC, MySQL, Maven, and MVC architecture.

Search Medicine Project in Java

Let’s understand the features and functionality of the Search Medicine Project in Java.

When the application is launched, users can find Login and Registration options on the home page. Existing users can log in using their credentials, while new users can register using the signup option.

The application supports two types of users:

  • ADMIN
  • USER/CUSTOMER

Each type of user has different functionalities and access permissions.

After Admin Login

After logging in as an Admin, the administrator can manage users, medicines, and medicine booking records.

Admin functionalities include:

  • Add new users
  • Edit user details
  • Update user information
  • Delete users
  • View users
  • Add new medicines to the database
  • Edit medicine details
  • Update medicine information
  • Delete medicines
  • Update medicine quantity
  • View available medicines
  • Manage medicine booking history

The Admin can add new medicines to the database and update the available quantity whenever required. The Admin can also view and manage the medicine booking history of customers.

After User Login

After logging in, users can access the medicine search and booking functionality.

User functionalities include:

  • View the list of available medicines
  • Search for medicines by name
  • View medicine information
  • Book medicines
  • Manage booking history
  • View previously booked medicines

Users can search for a required medicine by entering its name. The application retrieves the matching medicine information from the database and displays the available results.

Medicine Booking Functionality

The application provides a medicine booking functionality through which users can book available medicines.

When a user books a medicine, the available quantity is automatically updated according to the number of medicines booked.

For example, if the available quantity of a medicine is 20 and a user books 5, the remaining quantity will automatically be updated to 15.

The application also calculates the total price automatically based on the medicine price and booking quantity.

Total Price = Medicine Price × Quantity

If a user books more than one medicine, the application calculates the total price from the backend based on the price and quantity of each medicine.

For demonstration purposes, the price of each medicine is generated randomly by the application.

MVC Architecture

The Search Medicine Project in Java follows the MVC architecture. The application is divided into three main components: Model, View, and Controller.

Model

The Model contains the application’s data and business logic. Java classes and JDBC are used to perform database operations and communicate with the MySQL database.

View

The View represents the user interface of the application. It is developed using JSP, HTML, CSS, Bootstrap, and JavaScript.

Controller

The Controller manages user requests and controls the application flow. Java Servlets are used as the controller to process requests and communicate between the View and Model.

The basic application flow can be represented as:

Browser → JSP/View → Servlet/Controller → Java/JDBC/Model → MySQL Database

Running the Application on Tomcat

This is a Java web application that runs in a web browser and is deployed on the Apache Tomcat server.

After configuring the project and starting the Tomcat server, the application can be accessed locally using a URL similar to:

http://localhost:8080/Search-Medicine/

The exact URL may vary depending on the project name and Tomcat configuration.

YouTube Demo

Watch the project demonstration video to understand the functionality and workflow of the Search Medicine application.

Technologies Stack

Java: A versatile and platform-independent programming language widely used for backend development.
Servlets: Java classes that handle HTTP requests and responses on the server side.
JSP (JavaServer Pages): Server-side templates allowing Java code embedded within HTML for dynamic web page generation.
HTML (HyperText Markup Language): Markup language for structuring web content.
CSS (Cascading Style Sheets): Style sheet language used to define the presentation of HTML elements.
JavaScript: Programming language enabling interactive and dynamic behavior in web browsers as per the requrement.
Bootstrap: Front-end framework for building responsive and mobile-first web interfaces.
MySQL: Relational database management system (RDBMS) for data storage and retrieval.
Apache Tomcat: Web server and servlet container for deploying Java web applications.

Download Search Medicine Project Source Code

You can download the complete source code of the Search Medicine Project in Java from GitHub.

Download Search Medicine Project Source Code on GitHub

Search Medicine Project Source Code in Java

In this section, we will look at the folder structure and source code of the medicine module.

Since the application follows the MVC architecture, the different modules are divided into three main parts:

  • Model
  • View
  • Controller

This separation makes the application easier to understand, maintain, and modify.

Folder and Package Structure

The following image shows the folder and package structure of the Search Medicine Project in Java.

Search Medicine Project Folder Structure

The project structure separates the application components according to the MVC architecture, making it easier to manage the user interface, business logic, database operations, and request handling.

Conclusion

The Online Search Medicine Project in Java is a useful J2EE web application for understanding how to develop a Java-based online medicine search and booking system.

The project demonstrates the integration of Java, JSP, Servlet, JDBC, MySQL, Maven, Bootstrap, JavaScript, and Apache Tomcat using the MVC architecture.

Through this project, students can learn about user registration and login, role-based functionality, medicine management, medicine search, booking management, quantity updates, backend price calculation, database connectivity, and booking history.

The complete source code is available on GitHub and can be used for learning and academic project purposes.