A simple Java Web Application (Servlet + HTML) that collects student registration details via an HTML form and displays a Registration Successful confirmation page using a Java Servlet running on Apache Tomcat.
Registration Form → Successful Registration Page
| Student Registration Form | Registration Successful Page |
|---|---|
| Fields: First Name, Last Name, Email, Password, Gender, Course, Mobile | Displays all submitted details on success |
PracticeProject/
├── src/
│ └── main/
│ └── java/
│ └── com/
│ └── practice/
│ └── RegistrationServlet.java ← Java Servlet (backend logic)
├── WebContent/ (or src/main/webapp/)
│ ├── Registration.html ← Student Registration Form (frontend)
│ ├── WEB-INF/
│ │ └── web.xml ← Servlet mapping configuration
├── pom.xml ← Maven dependencies
└── .classpath ← Eclipse IDE classpath config
Make sure you have the following installed before running the project:
| Tool | Version | Download Link |
|---|---|---|
| Java JDK | 8 or higher | https://www.oracle.com/java/technologies/downloads/ |
| Apache Tomcat | 9.x or 10.x | https://tomcat.apache.org/download-90.cgi |
| Eclipse IDE (Java EE) | Latest | https://www.eclipse.org/downloads/ |
| Maven (optional) | 3.x | https://maven.apache.org/download.cgi |
- Download JDK 8 or higher from Oracle's website.
- Run the installer and follow the steps.
- Set the
JAVA_HOMEenvironment variable:- Windows:
Control Panel → System → Advanced → Environment Variables - Add new variable:
JAVA_HOME = C:\Program Files\Java\jdk-XX - Add to
PATH:%JAVA_HOME%\bin
- Windows:
- Verify installation:
java -version javac -version
- Go to: https://tomcat.apache.org/download-90.cgi
- Under Binary Distributions → Core, download the Windows Service Installer (.exe) or the zip file.
- Run the installer (or extract the zip) to a folder like
C:\apache-tomcat-9.x. - Set the
CATALINA_HOMEenvironment variable:CATALINA_HOME = C:\apache-tomcat-9.x
- Start Tomcat:
- Via installer: It starts automatically as a Windows Service.
- Via zip: Run
C:\apache-tomcat-9.x\bin\startup.bat
- Verify Tomcat is running — open your browser and go to:
You should see the Apache Tomcat welcome page. ✅
http://localhost:8080
- Open Eclipse IDE for Enterprise Java Developers.
- Go to:
File → Import → Existing Maven Projects(if Maven project) ORFile → Import → Existing Projects into Workspace. - Browse to the PracticeProject folder and click Finish.
- Right-click the project →
Properties → Targeted Runtimes→ Select Apache Tomcat v9.x.- If Tomcat is not listed: Go to
Window → Preferences → Server → Runtime Environments → Add → Apache Tomcat v9.xand point it to the Tomcat installation folder.
- If Tomcat is not listed: Go to
- Right-click the project in Eclipse.
- Select:
Run As → Run on Server. - Choose Apache Tomcat and click Finish.
- Eclipse will start Tomcat and open the browser automatically.
- Navigate to:
http://localhost:8080/PracticeProject/Registration.html
- In Eclipse: Right-click the project →
Export → WAR File→ Save asPracticeProject.war. - Copy
PracticeProject.warto:C:\apache-tomcat-9.x\webapps\ - Start Tomcat (run
startup.bat). - Tomcat will auto-deploy the WAR file.
- Open browser and go to:
http://localhost:8080/PracticeProject/Registration.html
- Open the registration form:
http://localhost:8080/PracticeProject/Registration.html - Fill in the following details:
- First Name — e.g., Chetan
- Last Name — e.g., Banait
- Email — e.g., example@gmail.com
- Password — e.g., q1234567
- Gender — Select Male or Female
- Course — Select from BCA / MCA / BSc / MSc
- Mobile Number — e.g., 7058478975
- Click the Register button.
- You will be redirected to the Registration Successful page at:
All submitted details are displayed on screen. ✅
http://localhost:8080/PracticeProject/RegistrationServlet
Browser (Registration.html)
|
| HTTP POST request
↓
RegistrationServlet.java (doPost method)
|
| Reads form parameters using request.getParameter()
| Generates HTML response with student details
↓
Browser (Registration Successful page)
- Registration.html — Contains an HTML form with
action="RegistrationServlet"andmethod="POST". - RegistrationServlet.java — Extends
HttpServlet, overridesdoPost(), reads parameters, and writes HTML response. - web.xml — Maps the URL pattern
/RegistrationServletto theRegistrationServletJava class.
<web-app>
<servlet>
<servlet-name>RegistrationServlet</servlet-name>
<servlet-class>com.practice.RegistrationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegistrationServlet</servlet-name>
<url-pattern>/RegistrationServlet</url-pattern>
</servlet-mapping>
</web-app>| Problem | Cause | Fix |
|---|---|---|
404 Not Found |
Project not deployed or wrong URL | Check Tomcat is running; verify the URL path |
500 Internal Server Error |
Java error in Servlet | Check Eclipse Console / Tomcat logs at logs/catalina.out |
| Tomcat port 8080 already in use | Another process using port | Change port in conf/server.xml → <Connector port="8080" to another port like 8081 |
| Servlet not found | Wrong web.xml mapping |
Make sure class name and package match exactly in web.xml |
| Build errors in Eclipse | Missing Servlet API JAR | Add Tomcat runtime to project build path |
If using Maven, make sure the Servlet API dependency is included:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
scope=providedmeans Tomcat will provide this JAR at runtime — do NOT include it in the WAR file.
Chetan Banait QA Engineer | Java Web Development Learner
- Email: chetanbanait30@gmail.com
This project is created for learning and practice purposes.