A Java Web Application to calculate the Body Mass Index.
- Input: Weight in Kilograms (Kg)
- Input: Height in Meters (m)
- Output: BMI rounded to 2 decimal places.
To achieve the "Honors" grade, the application was evolved from a command-line tool to a dynamic web application using Java Servlets and JSP.
| Feature | Console Version | Web Version (Servlets/JSP) |
|---|---|---|
| User Interface | Terminal (Scanner) | Browser (HTML Form) |
| Logic Execution | Local JVM | Apache Tomcat Container |
| Data Handling | Primitive variables | HTTP Request/Responses |
- Separation of Concerns: The UI is handled by
index.jsp, while the logic is isolated inBMIServlet.java. - Server Environment: Migrated from a local Java execution to a managed Servlet Container (Tomcat 10).
- Validation: Input validation now occurs at the server-side before rendering the result back to the user.
This project was built following the Jakarta EE 10 specifications, ensuring a modern and standardized Java Web environment.
| Component | Technology / Version |
|---|---|
| Runtime | Java JDK 21+ |
| Web Specification | Jakarta EE 10 (Servlet 5.0) |
| Server | Apache Tomcat 10.1.53 |
| IDE | IntelliJ IDEA Community Edition |
| Plugin | SmartTomcat |
| CSS Baseline | Normalize.css v8.0.1 |
- Jakarta Servlet API: Implemented a Controller-based architecture using
HttpServletto handle POST requests and state logic. - Cross-Browser Consistency: Integrated
normalize.cssto eliminate default browser inconsistencies (margins, button rendering, and font-scaling). - Resource Management: Organized static assets (CSS, Icons) into a dedicated web root structure (
/css,/img) for optimal deployment. - Atomic Git Workflow: Development was managed through a feature-branching strategy, utilizing
git stashfor context switching and descriptive, conventional commits.
- Plugin: Utilized
SmartTomcatto manage server execution and updated the "Deployment Directory" (SmartTomcat Settings) to target thewebappfolder specifically. - Library Management: Manually linked
servlet-api.jarandjsp-api.jarfromTomcat /libto the project dependencies. - Deployment: Configured
web.xmlfor servlet mapping instead of using automated IDE wizards.
From a "Standard Java layout" to a Maven or Gradle style structure (the industry standard for Web Apps)
bmi-calculator/
├── src/
│ └── main/
│ ├── java/ (Backend Servlets | LOGIC)
│ │ └── BMIServlet.java (Original code moved here and updated [Previous file "BMICalculator.java"])
│ └── webapp/ (Fronted JSPs | UI)
│ ├── css/
│ │ ├── normalize.css
│ │ └── style.css
│ ├── img/
│ │ └── favicon.ico
│ ├── index.jsp (HTML Form)
│ └── WEB-INF/ (Deployment Configuration)
│ └── web.xml (The configuration file | "The Brain")
├── .gitignore
└── README.md
- Course Provider: eFundae - Java Programming Category
- Jakarta EE Official Site: Jakarta.ee
- Servlet Documentation: Jakarta Servlet 6.0 Specification
Developed by Gabriel as part of the Java Web Development Honors Challenge.