Web Technology P1 PDF
Web Technology P1 PDF
UTTAR PRADESH
Lab File
Web Technology
EXP-1
1.Write a simple HTML code to display data/content on a webpage.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Display Data</title>
<style>
body {
background-color: yellow;
text-align: center;
padding: 30px;
h1 {
color: darkblue;
p{
font-size: 18px;
ul {
list-style-type: circle;
padding: 0;
}
li {
margin: 10px 0;
font-weight: bold;
img {
width: 250px;
border-radius: 10px;
margin-top: 20px;
button {
margin-top: 20px;
font-size: 16px;
background-color: darkblue;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
button:hover {
background-color: navy;
</style>
</head>
<body>
<p>Here’s a basic example of how content can be displayed beautifully on a web page.</p>
<ul>
<li>Clean Design</li>
<li>Simple Layout</li>
<li>Easy to Understand</li>
</ul>
<br>
</body>
</html>
Output:
EXP-2
2.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 for the content to that link.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Nawaj - CV</title>
<style>
body {
color: #2c3e50;
padding: 40px;
max-width: 850px;
margin: auto;
line-height: 1.6;
h1, h2 {
color: #1a1a1a;
h1 {
padding-bottom: 10px;
display: flex;
align-items: center;
gap: 20px;
.profile-pic {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
.section {
margin-top: 30px;
ul {
list-style: square;
padding-left: 20px;
}
.contact {
background-color: #ecf0f1;
padding: 15px;
border-radius: 10px;
margin-top: 20px;
.contact p {
margin: 5px 0;
.links {
margin-top: 10px;
.links a {
margin-right: 15px;
text-decoration: none;
color: #1abc9c;
font-weight: bold;
.resume-btn {
margin-top: 20px;
display: inline-block;
background-color: #1abc9c;
color: white;
border-radius: 8px;
text-decoration: none;
transition: 0.3s;
.resume-btn:hover {
background-color: #16a085;
}
</style>
</head>
<body>
<h1>
Nawaj
</h1>
<div class="contact">
<p><strong>Phone:</strong> 817180</p>
<p><strong>Email:</strong> [email protected]</p>
<div class="links">
</div>
</div>
<div class="section">
<h2>Objective</h2>
<p>To obtain a part-time opportunity where I can apply my technical knowledge and grow as a
Computer Science student by contributing to real-world projects.</p>
</div>
<div class="section">
<h2>Skills</h2>
<ul>
<li>Cybersecurity Fundamentals</li>
</ul>
</div>
<div class="section">
<h2>Projects</h2>
<ul>
<li><strong>Portfolio Website:</strong> Responsive personal site using HTML, CSS, and JS.</li>
<li><strong>Gaming Desk Setup Plan:</strong> Designed clean gaming layout with own devices.</li>
</ul>
</div>
<div class="section">
<h2>Education</h2>
<ul>
</ul>
</div>
<div class="section">
<ul>
</ul>
</div>
</body>
</html>
Output:
EXP-3
3.Implement CSS using all the ways of HTML.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Professional CV - Nawaj</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #add8e6;
color: #2c3e50;
.container {
max-width: 800px;
background-color: #ffffff;
padding: 40px;
border-radius: 12px;
h1 {
color: #1a1a1a;
text-align: center;
border-bottom: 2px solid #1abc9c;
padding-bottom: 10px;
.btn {
background-color: #1abc9c;
color: white;
border: none;
font-size: 16px;
border-radius: 8px;
cursor: pointer;
display: block;
text-align: center;
text-decoration: none;
.btn:hover {
background-color: #16a085;
</style>
</head>
<div class="container">
Welcome to my professional profile! I’m passionate about technology, coding, and real-world
problem-solving.
</p>\
<!-- Continue Button -->
</div>
</body>
</html>
Output:
EXP-4
4.Design HTML form for keepiong student record and validate it using java script
.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #e3f2fd;
margin: 0;
padding: 40px;
}
.form-container {
background-color: #ffffff;
max-width: 500px;
margin: auto;
padding: 30px;
border-radius: 10px;
h2 {
text-align: center;
color: #0d47a1;
label {
display: block;
margin-top: 15px;
font-weight: bold;
input, select {
width: 100%;
padding: 10px;
margin-top: 5px;
border-radius: 6px;
button {
margin-top: 20px;
width: 100%;
padding: 12px;
background-color: #0d47a1;
color: white;
font-size: 16px;
border: none;
border-radius: 6px;
cursor: pointer;
button:hover {
background-color: #1565c0;
.error {
color: red;
font-size: 13px;
</style>
</head>
<body>
<div class="form-container">
<label for="email">Email:</label>
<label for="course">Course:</label>
<option value="BCA">BCA</option>
<option value="MCA">MCA</option>
</select>
</form>
</div>
<script>
function validateForm() {
nameErr.textContent = "";
emailErr.textContent = "";
phoneErr.textContent = "";
rollErr.textContent = "";
courseErr.textContent = "";
valid = false;
}
if (!emailRegex.test(email)) {
valid = false;
if (!/^\d{10}$/.test(phone)) {
valid = false;
valid = false;
valid = false;
return valid;
</script>
</body>
</html>
Output:
EXP-5
5.Complete web page with HTML and CSS using bootstrap.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
<h1>Welcome to My Website</h1>
</div>
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]
alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output:
EXP-6
6.Write a javaScript to design a simple calculator to perform the following
operations: sum,product,difference and quotient.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Calculator</title>
<style>
body {
text-align: center;
margin-top: 50px;
input, button {
margin: 5px;
padding: 10px;
font-size: 16px;
</style>
</head>
<body>
<h1>Simple Calculator</h1>
<br>
<button onclick="calculate('sum')">Sum</button>
<button onclick="calculate('product')">Product</button>
<button onclick="calculate('difference')">Difference</button>
<button onclick="calculate('quotient')">Quotient</button>
<script>
function calculate(operation) {
let result;
if (isNaN(num1) || isNaN(num2)) {
} else {
switch (operation) {
case 'sum':
break;
case 'product':
break;
case 'difference':
break;
case 'quotient':
break;
default:
</script>
</body>
</html>
Output:
EXP-7
7.Write a program to implement Ajax.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
background-color: #e3f2fd;
padding: 40px;
.ajax-container {
max-width: 600px;
margin: auto;
background-color: #ffffff;
border-radius: 10px;
padding: 30px;
text-align: center;
#output {
margin-top: 20px;
padding: 15px;
background-color: #f1f8ff;
border-radius: 8px;
</style>
</head>
<body>
<div class="ajax-container">
<p>This example uses AJAX to get content from the page itself (simulating server response).</p>
</div>
<script>
function loadData() {
const xhr = new XMLHttpRequest();
const responseText = "Hello Nawaj! This is data loaded via AJAX. ";
xhr.onload = function () {
document.getElementById('output').innerHTML = `<strong>Server
says:</strong><br>${this.responseText}`;
} else {
};
xhr.onerror = function () {
};
xhr.send();
</script>
</body>
</html>
Output:
EXP-8
8. 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
a responsive website navigation bar using Bootstrap and create for your Institute.
Code:
<!DOCTYPE html>
<html>
<head>
<title>Galgotias University</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
<style>
body {
background-color: yellow;
</style>
</head>
<body>
<div class="container-fluid">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
<li class="nav-item">
</li>
<li class="nav-item">
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]
alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Output:
EXP-9
9.Write a program in jquery to click the button and display the content
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
body {
background: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
.container {
background: #fff;
padding: 40px;
border-radius: 12px;
text-align: center;
max-width: 400px;
width: 90%;
h1 {
font-size: 24px;
margin-bottom: 10px;
}
p.subtitle {
color: #666;
font-size: 14px;
margin-bottom: 30px;
#showBtn {
font-size: 16px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
#showBtn:hover {
background-color: #0056b3;
#content {
display: none;
margin-top: 25px;
font-size: 18px;
color: #333;
@keyframes fadeIn {
to {opacity: 1;}
</style>
</head>
<body>
<div class="container">
</div>
<script>
$(document).ready(function(){
$('#showBtn').click(function(){
$('#content').fadeIn();
});
});
</script>
</body>
</html>
Output:
EXP-10
10.Design a web page using Jquery selectors.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
body {
padding: 30px;
background-color: #f0f2f5;
h1 {
color: #333;
.highlight {
background-color: yellow;
.box {
padding: 15px;
margin: 10px 0;
border-radius: 6px;
background-color: #fff;
button {
margin-top: 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #0056b3;
</style>
</head>
<body>
<br/>
<script>
$(document).ready(function() {
$('#actionBtn').click(function() {
// ID selector
$('#box1').css('color', 'green');
// Class selector
$('.highlight').css('font-weight', 'bold');
// Tag selector
$('p').css('font-size', '18px');
// Attribute selector
$('input[type="text"]').val('jQuery is working!');
// Multiple selectors
});
});
</script>
</body>
</html>
Output:
EXP-11
11. Design a web page to create a button for to change button color, show text,
showimage, and Reset Button using Jquery.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
body {
padding: 40px;
background: #f4f4f4;
text-align: center;
button {
margin: 10px;
font-size: 16px;
cursor: pointer;
#output {
margin-top: 20px;
#output img {
max-width: 200px;
display: block;
</style>
</head>
<body>
<button id="resetBtn">Reset</button>
<div id="output"></div>
<script>
$(document).ready(function () {
$("#colorBtn").click(function () {
$(this).css("background-color", "#28a745");
$(this).css("color", "white");
});
$("#textBtn").click(function () {
});
$("#imgBtn").click(function () {
});
$("#resetBtn").click(function () {
$("#output").html("");
});
});
</script>
</body>
</html>
Outout:
EXP-12
12. Write a program using SERVLET/ JSP and HTML to create a form and display the
details entered by the user.
Code:
<!DOCTYPE html>
<html>
<head>
<body>
<%
%>
<h2>Details Entered:</h2>
<%
} else {
%>
</form>
<%
%>
</body>
</html>
Output:
EXP-13
13. Write simple SERVLET/ JSP program to set cookies and read it.
Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="output"></p>
<script>
function setCookie() {
function showCookies() {
</script>
</body>
</html>
Output:
EXP-14
14. Create a SERVLET/ JSP/ JSP page for login system using session.
Code:
EXP-15
15.Write a SERVLET/JSP/JSP program for sending e-mail.
Code:
<!DOCTYPE html>
<html>
<head >
</head >
<body>
</form >
</body>
</html>
props.put("mail.smtp.auth", "true");
}
Output: