Goal: Capture your details, validate inputs, and calculate your score.
In this part, you will create a simple webpage form, a Java class to store your information, and a Servlet to do save the information.
Task 1: The Data Class (ResumeBean.java)
Save this in package: com.csc584.model
Create normal Java variables (private) for:
Your Name, Student ID, Email, Program Code (e.g., CS230), and Career Objective.
CGPA, Years of Experience, a list of your top Technical Skills (e.g., Java, Web, Database), and whether you are available for an internship (true/false).
Write standard getters and setters.
Write your personalized score method:
Name the method using your Student ID last 4 digits: calculateStrength_ID3()(Example for Student ID ...3456: name it public double calculateStrength_3456())
Formula Score = (50 + L1 X 5) + (Years of Experience X 5) + (Number of Skills X (L2 + 2))
Example: If your ID is ...3456 (so L1 = 6, L2 = 5), with 1 year of experience and 3 skills:
Base = 50 + (6 x 5) = 80
Experience = 1 x 5 = 5
Skills = 3 x (5 + 2) = 3 x7 = 21
Total = 80 + 5 + 21 = 106 ->100.0 %
Task 2: The HTML Input Form (resumeForm.html)
Save this in your web root folder (Webpages/resumeForm.html).
Create a clean form that lets you enter your details:
Text boxes for Name, Student ID, Email, CGPA, and Career Objective.
Checkboxes for your skills (e.g., [ ] Java, [ ] Python, [ ] SQL).
Radio buttons for Internship: [ ] Yes / [ ] No.
A hidden security token: Add this hidden field where the value is L1 + L2:
<!-- Example for L1=6, L2=5 -> 6+5=11 -->
<input type="hidden" name="securityToken_456" value="11">
Set the form to send data to your servlet:
<form action="ResumeController" method="POST">
Task 3: The Controller Servlet (ResumeController.java)
Save this in package: com.csc584.controller
Write a standard Java Servlet that extends HttpServlet and handles doPost():
Check for errors:
Make sure the entered email contains your campus student domain (@student.uitm.edu.my).
Make sure CGPA is between 0.00 and 4.00.
Check that the hidden token matches your L1 + L2.
Save into Session:
Save your resume object into HttpSession using your Student ID in the key name:
session.setAttribute("candidate_2024123456_profile", resumeBean);
Add a simple edit counter in the session. If the user edits their profile more than (L1 + 5) times, display a friendly message: "You have reached your edit limit for this session!"
Show a preview: Use standard print statements (out.println) to show a simple confirmation page displaying the details you entered and your calculated Profile Strength Score.
Task 4: The Deployment Descriptor (web.xml)
Register and map your servlet manually inside WEB-INF/web.xml:
<servlet>
<servlet-name>ResumeServlet</servlet-name>
<servlet-class>com.csc584.controller.ResumeController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ResumeServlet</servlet-name>
<url-pattern>/ResumeController</url-pattern>
</servlet-mapping>