Skip to content

viswadarshan-024/Java-Based-E-commerce-Web-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Mini E-Commerce Web Application

Overview

This project is a Mini online store web application built using Java Servlets, JSP, and Tomcat. It demonstrates core web application concepts such as request/response handling, session management, authentication, multithreading, logging, filters and design principles such as MVC, SOLID, KISS princples.

The application runs entirely in memory — no database is required. Products and users are predefined and stored in memory for simplicity.

How to Run the Application

Prerequisites

Java JDK 17+ (or compatible version)

Apache Tomcat 10+ (Servlet API 5, Jakarta EE)

A web browser

Steps

Clone or download the project source.

Import the project into your IDE (Eclipse recommended) as a Dynamic Web Project.

Configure Tomcat in your IDE or deploy the generated WAR file to Tomcat’s server or run the application on the IDE.

Open the application in a browser at:

http://localhost:8080/mini-ecommerce

Implemented Features

Home Page

Simple landing page with navigation links (catalog, login, logout).

User Authentication

Predefined users stored in memory.

Login/Logout functionality with password hashing features.

Session management ensures only logged-in users can access cart and checkout.

Product Catalog

In-memory product list with ID, name, description, and base price.

Displayed in JSP with user-friendly formatting.

Product Details

Clicking a product shows detailed info.

Search

Search bar to filter products by name.

Shopping Cart

Add/remove items from cart.

Cart persists within user session.

Checkout

Form for user details (name, email, address).

Order confirmation page.

Cart is cleared after successful checkout.

Logging

Implemented using a Filter.

Logs request URL, User-Agent (browser type), and timestamp.

Dynamic Pricing

Prices adjusted based on browser type:

Chrome → +10%

Firefox → −5%

Safari → +15%

Others → base price

Design Choices & Assumptions

MVC Architecture:

Controllers (Servlets) handle requests.

Models represent domain objects (Product, User, CartItem, etc.).

Views (JSP) only render data without containing business logic.

Session Storage:

Cart is stored in the user’s session (per logged-in user).

Since this is a prototype, scalability concerns (e.g., distributed session management) are not addressed.

In-Memory Data:

No database is used.

Products and users are initialized in memory at application startup.

Dynamic Pricing:

Implemented centrally through a utility (PricingUtil) so JSPs do not contain logic, keeping MVC principles intact.

Logging:

Implemented via a Filter to ensure every request is logged automatically.

This project demonstrates core web development skills with Java Servlets and JSP while adhering to clean design principles (MVC, SOLID, separation of concerns, filters, utilities, session management, KISS principle).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published