Lab 4
Lab 4
ENGINEERING &TECHNOLOGY
Web Technology
Course Code – R1UC626C
Semester – VI th
Section - 37
1|P a g e
Experiment :- 01
Program :-
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a simple HTML page that displays some content.</p>
<h2>My Hobbies:</h2>
<ul>
<li>Reading</li>
<li>Traveling</li>
<li>Learning HTML</li>
</ul>
Output :-
4|P a g e
Experiment no :- 02
Write an HTML code to display your CV on a web page. Write an HTML code to implement the concept of frames
with 2 frames: one for hyperlinks and another for opening the content to that link.
Program:-
<!DOCTYPE html>
<html>
<head>
<title>Preeti Kumari - CV</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
}
.container {
width: 60%;
margin: 50px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
h1, h2, h3 {
color: #333;
}
hr {
border: 0;
height: 1px;
background-color: #ccc;
}
.section {
margin-bottom: 20px;
}
.contact {
margin-top: 10px;
}
.skills ul {
list-style-type: square;
}
</style>
</head>
<body>
<div class="container">
<h1>Preeti</h1>
<p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>3rd Year B.Tech CSE Student | Galgotias University</p>
5|P a g e
<hr>
<div class="section">
<h2>Objective</h2>
<p>To secure a challenging internship that allows me to leverage my technical skills, enhance my
knowledge, and contribute to organizational goals.</p>
</div>
<div class="section">
<h2>Education</h2>
<p><strong>B.Tech in Computer Science & Engineering</strong><br>Galgotias University<br>CGPA:
8.9/10</p>
<p><strong>Senior Secondary Examination</strong><br>DAV<br>Percentage: 78.4%</p>
<p><strong>Secondary Examination</strong><br>DAV<br>Percentage: 74%</p>
</div>
<div class="section">
<h2>Technical Skills</h2>
<ul>
<li>Languages: C, C++, Java, Python, SQL, HTML</li>
<li>Frameworks: Jetpack Compose</li>
<li>Tools: Visual Studio Code, MySQL, Python IDE, MS Word, MS Excel</li>
</ul>
</div>
<div class="section">
<h2>Projects</h2>
<ul>
<li><strong>Spotify Clone:</strong> Developed a music streaming platform using HTML, CSS, and
JavaScript.</li>
<li><strong>Employee Management System:</strong> Created a Java-based system using Swing, AWT,
and JDBC.</li>
<li><strong>Image Manipulation:</strong> Implemented image processing tasks using Python and
OpenCV.</li>
</ul>
</div>
<div class="section">
<h2>Internships</h2>
<ul>
<li><strong>Oracle Academy Course:</strong> Java Fundamentals Internship</li>
<li><strong>AICTE-Eduskills:</strong> AWS - Data Engineering Virtual Internship</li>
<li><strong>AICTE-Eduskills:</strong> AI-ML Virtual Internship</li>
</ul>
</div>
<div class="section">
<h2>Hobbies</h2>
<p>Yoga, Cooking, Reading</p>
</div>
6|P a g e
<h3>Contact</h3>
<p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
</div>
</div>
</body>
</html>
Output :-
7|P a g e
Experiment no:- 03
Implement CSS using all the ways of HTLM
Program
1. Inline CSS
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS Example</title>
</head>
<body>
<h1 style="color: blue; font-size: 30px;">Hello, Inline CSS!</h1>
</body>
</html>
2. Internal CSS
<!DOCTYPE html>
<html>
<head>
<title>Internal CSS Example</title>
<style>
h1 {
color: green;
font-size: 32px;
}
p{
color: gray;
}
</style>
</head>
<body>
<h1>Welcome to Internal CSS</h1>
<p>This is a paragraph.</p>
</body>
</html>
3. External CSS
<!DOCTYPE html>
<html>
<head>
<title>External CSS Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Welcome to External CSS</h1>
<p>This is styled from an external file.</p>
8|P a g e
</body>
</html>
h1 {
color: red;
font-size: 36px;
}
p{
color: darkgray;
}
Output :-
9|P a g e
Experiment no:- 04
Design HTML form for keeping student record and validate it using Java script .
Program
<!DOCTYPE html>
<html>
<head>
<title>Student Record Form</title>
<style>
body {
font-family: Arial;
background-color: #f5f5f5;
padding: 20px;
}
.form-container {
background: white;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: auto;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
label {
display: block;
margin-top: 10px;
}
input, select {
width: 100%;
padding: 8px;
margin-top: 4px;
}
button {
margin-top: 15px;
padding: 10px;
width: 100%;
background-color: #4CAF50;
color: white;
border: none;
font-size: 16px;
}
</style>
<script>
function validateForm() {
let name = document.forms["studentForm"]["name"].value.trim();
let roll = document.forms["studentForm"]["roll"].value.trim();
10 | P a g e
let email = document.forms["studentForm"]["email"].value.trim();
let age = document.forms["studentForm"]["age"].value.trim();
let course = document.forms["studentForm"]["course"].value;
// Name validation
if (name === "") {
alert("Name is required.");
return false;
}
// Email validation
let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
alert("Please enter a valid email address.");
return false;
}
// Age validation
if (age === "" || isNaN(age) || age < 5 || age > 100) {
alert("Please enter a valid age between 5 and 100.");
return false;
}
// Course validation
if (course === "") {
alert("Please select a course.");
return false;
}
<body>
<div class="form-container">
<h2>Student Record Form</h2>
<form name="studentForm" onsubmit="return validateForm()">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="text" id="email" name="email">
11 | P a g e
<label for="age">Age:</label>
<input type="text" id="age" name="age">
<label for="course">Course:</label>
<select id="course" name="course">
<option value="">--Select Course--</option>
<option value="BCA">BCA</option>
<option value="B.Tech">B.Tech</option>
<option value="BSc">BSc</option>
<option value="MCA">MCA</option>
</select>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
Output :-
12 | P a g e
Experiment no:- 05
Complete Web page with HTML and CSS using bootstrap
Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootstrap Web Page</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.hero {
background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
url('https://source.unsplash.com/1600x900/?nature');
background-size: cover;
color: white;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="#">My Website</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">About</a></li>
<li class="nav-item"><a class="nav-link" href="#">Services</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
13 | P a g e
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output :-
14 | P a g e
Experiment no:- 06
Write a JavaScript to design a simple calculator to perform the following operations:
sum, product, difference and quotient.
PROGRAM
<!DOCTYPE html>
<html>
<head>
<title>Simple Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
}
.calculator {
max-width: 300px;
margin: auto;
border: 1px solid #ccc;
padding: 20px;
border-radius: 10px;
}
input, button {
width: 100%;
margin: 10px 0;
padding: 10px;
font-size: 16px;
}
.result {
font-weight: bold;
margin-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="calculator">
<h2>Simple Calculator</h2>
<input type="number" id="num1" placeholder="Enter first number">
<input type="number" id="num2" placeholder="Enter second number">
<button onclick="calculate('sum')">Add</button>
<button onclick="calculate('difference')">Subtract</button>
<button onclick="calculate('product')">Multiply</button>
<button onclick="calculate('quotient')">Divide</button>
15 | P a g e
</div>
<script>
function calculate(operation) {
const num1 = parseFloat(document.getElementById("num1").value);
const num2 = parseFloat(document.getElementById("num2").value);
let result;
if (isNaN(num1) || isNaN(num2)) {
result = "Please enter valid numbers.";
} else {
switch(operation) {
case 'sum':
result = `Sum: ${num1 + num2}`;
break;
case 'difference':
result = `Difference: ${num1 - num2}`;
break;
case 'product':
result = `Product: ${num1 * num2}`;
break;
case 'quotient':
if (num2 === 0) {
result = "Cannot divide by zero!";
} else {
result = `Quotient: ${num1 / num2}`;
}
break;
default:
result = "Invalid operation.";
}
}
document.getElementById("result").innerText = result;
}
</script>
</body>
</html>
16 | P a g e
Output :-
17 | P a g e
Experiment no:- 07
Write a program to implement AJAX.
PROGRAM
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Advanced AJAX Example</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background: linear-gradient(to right, #dbe9f4, #e6f1f7);
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
text-align: center;
}
.card {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.card h2 {
margin-bottom: 20px;
color: #333;
}
.card button {
padding: 10px 20px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.card button:hover {
background-color: #2980b9;
}
#message {
18 | P a g e
margin-top: 20px;
font-size: 16px;
color: #2c3e50;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<h2>Advanced AJAX Example</h2>
<button onclick="loadMessage()">Load Server Message</button>
<div id="message"></div>
</div>
</div>
<script>
function loadMessage() {
Output :-
19 | P a g e
Experiment no:- 08
Implementation of JSP to generate server side response Write a JSP code to generate dynamic webpage using server
response. Write a code to create a navigation bar using Bootstrap and create a responsive website for your Institute.
PROGRAM
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Galgotias University</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body { background-color: #007BFF; color: white; }
.navbar { background-color: blue; }
.notice { background-color: skyblue; color: black; padding: 10px; font-weight: bold; }
.about { color: white; padding: 10px; }
.btn-explore { background-color: green; color: white; }
.btn-apply { background-color: yellow; color: black; }
.btn-brochure { background-color: skyblue; color: black; }
.screen-share { background-color: #f8f9fa; color: black; padding: 10px; margin-top: 10px; display:
flex; justify-content: space-between; align-items: center; }
.underline { text-decoration: underline; }
#content-area { margin: 30px auto; background-color: white; color: black; padding: 20px; border-
radius: 10px; width: 80%; min-height: 200px; }
</style>
</head>
<body>
20 | P a g e
<li class="nav-item"><a class="nav-link" href="#">More</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>
document.getElementById("btnExplore").addEventListener("click", () => {
contentArea.innerHTML = `
21 | P a g e
<h3>Courses Offered</h3>
<ul>
<li>B.Tech in Computer Science</li>
<li>BBA, MBA</li>
<li>B.A. LL.B, B.Com, B.Sc, BCA</li>
<li>PhD in multiple domains</li>
</ul>
`;
});
document.getElementById("btnApply").addEventListener("click", () => {
contentArea.innerHTML = `
<h3>Online Admission Form</h3>
<p>Please fill in your basic details below:</p>
<form>
<div class="mb-3">
<input type="text" class="form-control" placeholder="Full Name">
</div>
<div class="mb-3">
<input type="email" class="form-control" placeholder="Email Address">
</div>
<div class="mb-3">
<input type="text" class="form-control" placeholder="Course Interested In">
</div>
<button type="submit" class="btn btn-success">Submit</button>
</form>
`;
});
document.getElementById("btnBrochure").addEventListener("click", () => {
contentArea.innerHTML = `
<h3>Galgotias University Brochure</h3>
<p>Download the brochure to explore our university, programs, and facilities.</p>
<button class="btn btn-primary"> Download PDF</button>
`;
});
});
</script>
</body>
</html>
22 | P a g e
Output :-
23 | P a g e
Experiment no:- 09
Write a code to create a navigation bar using Bootstrap and create a responsive website for your Institute.
PROGRAM
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Galgotias University</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f4f9ff;
font-family: Arial, sans-serif;
}
.hero {
background-color: #003366;
color: white;
padding: 60px 20px;
text-align: center;
}
.btn-custom {
transition: background-color 0.3s ease, color 0.3s ease;
}
.btn-success.btn-custom:hover {
background-color: #146c43 !important;
color: #fff !important;
}
.btn-warning.btn-custom:hover {
background-color: #d39e00 !important;
color: #000 !important;
}
.btn-info.btn-custom:hover {
background-color: #0dcaf0 !important;
color: #000 !important;
}
.course-img {
width: 100%;
max-width: 250px;
height: auto;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
}
24 | P a g e
marquee {
font-size: 20px;
font-weight: bold;
color: #003366;
background-color: #e6f0ff;
padding: 10px 0;
}
</style>
<script>
function loadContent(section) {
let content = "";
switch (section) {
case "admissions":
content = `
<h3>Admissions 2025</h3>
<p>We offer UG, PG, and PhD programs across diverse fields.</p>
<ul>
<li>Application Deadline: 31st May 2025</li>
<li>Entrance: GU Aptitude Test</li>
<li><a href="#">Apply Now</a></li>
</ul>`;
break;
case "departments":
content = `
<h3>Departments</h3>
<ul>
<li>Engineering</li>
<li>Management</li>
<li>Law</li>
<li>Pharmacy</li>
<li>Design</li>
</ul>`;
break;
case "more":
content = `
<h3>Campus Life & More</h3>
<p>Experience vibrant campus life with events, sports, and career support.</p>
<ul>
<li>?? Hostels & Cafeteria</li>
<li>?? Tech & Cultural Fests</li>
<li>?? Career Services & Internships</li>
</ul>`;
break;
case "contact":
content = `
<h3>Contact Us</h3>
<p>Galgotias University, Greater Noida, UP</p>
<p>Email: [email protected]</p>
25 | P a g e
<p>Phone: +91-120-1234567</p>`;
break;
case "brochure":
content = `
<h3>Download Brochure</h3>
<p>Access course details, faculty, and campus facilities.</p>
<a class="btn btn-primary" href="#" download>Download PDF</a>`;
break;
case "explore":
content = `
<h3>Explore Our Courses</h3>
<div class="row">
${getCourseCard("Engineering", "https://via.placeholder.com/250x150?text=Engineering")}
${getCourseCard("Management", "https://via.placeholder.com/250x150?text=Management")}
${getCourseCard("Law", "https://via.placeholder.com/250x150?text=Law")}
${getCourseCard("Pharmacy", "https://via.placeholder.com/250x150?text=Pharmacy")}
${getCourseCard("Design", "https://via.placeholder.com/250x150?text=Design")}
</div>`;
break;
case "apply":
content = `
<h3>Apply Online</h3>
<p>Fill the online form and kickstart your academic journey with Galgotias.</p>
<ol>
<li>Register with your email</li>
<li>Fill personal & academic details</li>
<li>Upload documents</li>
<li>Pay application fee</li>
</ol>
<a href="#" class="btn btn-warning">Start Application</a>`;
break;
default:
content = `
<h2>About Us</h2>
<p>Galgotias University is a leading private university in India with a focus on academic
excellence and global standards.</p>`;
}
document.getElementById("dynamicContent").innerHTML = content;
}
26 | P a g e
</script>
</head>
<body>
<div id="dynamicContent">
<h2>About Us</h2>
<p>Galgotias University is one of India's top private universities, committed to academic excellence, industry
connections, and holistic student development.</p>
</div>
27 | P a g e
<!-- Action Buttons -->
<div class="mt-4">
<button class="btn btn-success btn-custom" onclick="loadContent('explore')">Explore Courses</button>
<button class="btn btn-warning btn-custom" onclick="loadContent('apply')">Apply Online</button>
<button class="btn btn-info btn-custom" onclick="loadContent('brochure')">Download Brochure</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output :-
28 | P a g e
Experiment no:- 10
Write a program in jquery to click the button and display
PROGRAM
<!DOCTYPE html>
<html>
<head>
<title>Simple jQuery Example</title>
<!-- jQuery CDN -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$("#changeBtn").click(function(){
$("#text").text("The text has been changed using jQuery!");
});
});
</script>
</body>
</html>
Output :-
29 | P a g e
Experiment no:- 11
Design a Web Page using Jquery Selectors
PROGRAM
<!DOCTYPE html>
<html>
<head>
<title>jQuery Selectors Example</title>
<style>
.highlight {
color: crimson;
font-weight: bold;
}
input {
margin: 5px;
}
</style>
<script>
$(document).ready(function() {
$("#apply").click(function() {
30 | P a g e
<h2>Working with jQuery Selectors</h2>
</body>
</html>
Output :-
31 | P a g e
Experiment no:- 12
Design a web page to create a button for to change button color, show text, showimage, and Reset Button using Jquery
PROGRAM
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery Multiple Button Actions</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
button {
padding: 10px 20px;
font-size: 16px;
margin: 10px;
}
#output {
margin-top: 20px;
font-size: 18px;
}
#image {
margin-top: 15px;
display: none;
width: 200px;
}
</style>
</head>
<body>
<center>
<h2>Sample Action Buttons</h2></center><br>
<br><br><br>
<div id="output"></div>
<img id="image" src="C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg" >
<script>
// Button 1: Change background color
$("#btnColor").click(function() {
$(this).css("background-color", "Red");
$(this).css("color", "white");
$(this).text("Color Changed!");
});
32 | P a g e
$("#output").text("Hello! I am Deepak Sonker.");
});
</body>
</html>
Output :-
33 | P a g e
Experiment no:- 13
Write a program using SERVLET/ JSP and HTML to create a form and display the details entered by the user.
PROGRAM
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%!
String host = "smtp.example.com";
String from = "[email protected]";
String password = "your_password";
%>
<%
String to = request.getParameter("to");
String subject = request.getParameter("subject");
String messageText = request.getParameter("message");
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
message.setText(messageText);
Transport.send(message);
out.println("Email sent successfully!");
} catch (MessagingException mex) {
mex.printStackTrace();
out.println("Error: " + mex.getMessage());
}
%>
34 | P a g e
Java code
<html>
<head>
<title>Send Email</title>
</head>
<body>
<form method="post" action="send_email.jsp">
To: <input type="text" name="to"><br>
Subject: <input type="text" name="subject"><br>
Message: <textarea name="message"></textarea><br>
<input type="submit" value="Send Email">
</form>
</body>
</html>
Output :-
35 | P a g e
INDEX
3 Write an HTML code to implement the concept of frames with 2 frames: 25 – 03 – 2025
one for hyperlinks and another for opening the content to that link.
5 Design HTML form for keeping student record and validate it using 01 – 04 – 2025
JavaScript.
6 Complete Web page with HTML and CSS using Boot strap 01 – 04 – 2025
7 Write a program to implement AJAX. 08 – 04 – 2025
9 Write a JSP code to generate dynamic web page using server response. 15 – 04 – 2025
10 Write a program using Servlet and HTML to create a form and display the 15 – 04 – 2025
details entered by the user
12 Create a Servlet/JSP page for the login system using session 20 – 04 – 2025
36 | P a g e
Experiment no:- 14
PROGRAM :-
setCookies.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Setting Cookies</title>
</head>
<body>
<h1>Setting Cookies</h1>
<form action="main.jsp" method="GET">
First Name: <input type="text" name="first_name"> <br /><br/> Last
Name: <input type="text" name="last_name" /><br/><br/> <input type="submit" value="Submit" />
</form>
</body>
</html>
main.jsp
<%
// Create cookies for first and last names.
Cookie firstName = new Cookie("first_name", request.getParameter("first_name"));
Cookie lastName = new Cookie("last_name", request.getParameter("last_name"));
// Set expiry date after one hour for both the cookies.
firstName.setMaxAge(60 * 60);
lastName.setMaxAge(60 * 60);
37 | P a g e
OUTPUT:-
Once you click on the Submit button, you will get the following output
38 | P a g e
JSP Cookies Read Example
ReadCookies.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Read Cookies</title>
</head>
<body>
<h1>Read Cookies </h1>
<%
Cookie cookie = null;
Cookie[] cookies = null;
cookies = request.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
cookie = cookies[i];
out.print("Name : " + cookie.getName() + ", ");
out.print("Value: " + cookie.getValue() + " <br/>");
}
} else {
out.println("<h2>No cookies founds</h2>");
}
%>
</body>
</html>
OUTPUT:-
39 | P a g e
Experiment no:- 15
Create a SERVLET/JSP/JSP page for login System using session.
Program:-
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="login.jsp" method="post">
User name :<input type="text" name="usr" /><br><br> password :<input
type="password" name="password" /><br> <br><input type="submit" />
</form>
<p>
New user. <a href="register.html">Login Here</a>
</body>
</html>
login.jsp
40 | P a g e
Register.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="registrationProcess.jsp" method="post">
First name :<input type="text" name="fname" /> <br><br>Last name :<input
type="text" name="lname" /> <br><br>Email ID :<input type="text"
name="email" /><br><br> User name :<input type="text" name="userid" /><br><br>
password :<input type="password" name="password" /> <br><br><input
type="submit" />
</form>
</body>
</html>
registrationProcess.jsp
41 | P a g e
OUTPUT
if you are a new user click on the “Login Here” link, you will get the following page where you have to enter the
details and click on the “Submit” button.
After clicking on the “Submit” button, you will get the following output. Now to log in click on the “Login” link.
42 | P a g e