WT Lab
WT Lab
Professional Skills: The ability to research, understand and implement computer programs
in the areas related to algorithms, system software, multimedia, web design, big data
PSO1
analytics, and networking for efficient analysis and design of computer-based systems of
varying complexity.
Problem-Solving Skills: The ability to apply standard practices and strategies in software
service management using open-ended programming environments with agility to deliver a
PSO2
quality service for business success.
Course Code Course Title Core/Elective
PC 752 CS Web Technologies Lab Core
Prerequisite Contact Hours per Week CIE SEE Credits
L T D P
- - - 4 25 50 2
Course Objectives:
The objectives of this course is to impart knowledge of
To develop skills in designing & implement static and dynamic websites.
To develop server-side programming for handling user requests
To develop database processing and communication.
Course Outcomes:
After completing this course, the student will be able to:
Analyze a web page and identify its elements and attributes.
Apply Cascading Style Sheets web pages for a good aesthetic sense of design.
Build dynamic web pages using JavaScript.
Develop server-side scripting using Middleware Technologies for various application
scenarios
Facilitate back-end Database communication for users via Middleware Technologies
LIST of EXPERIMENTS
List of Programs
Program steps:
Open notepad
Create tags – table, tr, th, td
Fill data
Save as html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Static Website with HTML Table</title>
<style>
/* Optional: Add some basic styling for better
presentation */body {
font-family: Arial, sans-
serif;margin: 20px;
table {
LORDS ENGINEERING COLLEGE BE VII SEMESTER 7
WEB TECHNOLOGIES LAB
width: 100%;
border-collapse:
collapse;margin-top:
20px;
}
th, td {
border: 1px solid
#ddd;padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>Sample Table</h1>
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead
>
<tbody>
<tr>
<td>Row 1, Cell 1</td>
</tr>
<tr>
<td>Row 3, Cell 1</td>
<td>Row 3, Cell 2</td>
<td>Row 3, Cell 3</td>
</tr>
</tbody
>
</table>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form</title>
<style>
body
{
font-family: Arial, sans-
serif;margin: 20px;
}
form {
width: 300px;
margin: 0
auto;
}
label {
display: block;
margin-bottom:
8px;
}
input {
width
:
100%
;
padding:
8px;
margin-bottom:
16px; box-sizing:
border-box;
}
button { background-
LORDS ENGINEERING COLLEGE BE VII SEMESTER 10
WEB TECHNOLOGIES LAB
color:
#4CAF50;color: white;
padding: 10px
15px;border:
none; border-
radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>Registration Form</h1>
<form>
<label for="fname">First Name:</label>
<input type="text" id="fname" name="fname" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Register</button>
</form>
</body>
</html>
i) Inline CSS:
The Internal CSS has <style> tag in the <head> section of the HTML document. This CSS
style is an effective way to style single pages. Using the CSS style for multiple web pages is
time-consuming because we require placing the style on each web page.
Program steps:
Open notepad and write html code
In the HTML page, locate where css is requried
Put the csss code the html content
Add the rules of CSS in the new line.
Close the style tag.
i) Internal CSS:
An internal CSS is used to define a style for a single HTML page.
An internal CSS is defined in the <head> section of an HTML page, within a <style> element.
Program steps:
<!DOCTYPE html>
<html lang="en">
<head>
LORDS ENGINEERING COLLEGE BE VII SEMESTER 12
WEB TECHNOLOGIES LAB
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form</title>
<style>
body
{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0; display:
flex;
justify-content: center;align-
items: center; height: 100vh;
}
form {
background-color: #fff;border-
radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);padding: 20px;
h1 {
color: #333;
}
label {
display: block; margin-
bottom: 8px;color: #555;
}
input {
width: 100%; padding: 10px;
margin-bottom: 16px;
box-sizing: border-box; border:1px
solid #ccc; border-radius: 4px;
}
button {
background-color: #4CAF50;color:
white;
padding: 10px 15px;border:
none; border-radius: 4px;
LORDS ENGINEERING COLLEGE BE VII SEMESTER 13
WEB TECHNOLOGIES LAB
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<form>
<h1>Registration Form</h1>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Register</button>
</form>
</body>
</html
Output:
Program steps:
Open an html page
Reading: Dynamically displaying data
Creating: Allow User Input
Editing data before submit.
Save the file as html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Registration Form</title>
<style>
body
{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana,sans-
serif;background-color: #f4f4f4;
margin: 0;
padding: 0;
display:
flex;
justify-content:
center;align-items:
center; height:
100vh;
}
LORDS ENGINEERING COLLEGE BE VII SEMESTER 16
WEB TECHNOLOGIES LAB
form {
background-color:
#fff;border-radius:
8px;
box-shadow: 0 0 10px rgba(0, 0, 0,
0.1);padding: 20px;
width: 300px;
text-align:
center;
}
h1 {
color: #333;
}
label {
display: block;
margin-bottom:
8px;color: #555;
}
input {
width: 100%;
padding: 10px;
margin-bottom:
16px;
box-sizing: border-
box; border: 1px
solid #ccc; border-
radius: 4px;
}
button { background-
color:
#4CAF50;color: white;
padding: 10px
15px;border:
none; border-
radius: 4px;
cursor: pointer;
font-size: 16px;
button:hover {
background-color: #45a049;
}
#greeting {
margin-top:
20px;color:
#4CAF50;
}
</style>
</head>
<body>
<form id="registrationForm">
<h1>Registration Form</h1>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<div id="greeting"></div>
<script>
function displayGreeting() {
// Get values from the form
var firstName =
document.getElementById('fname').value;varlastName =
document.getElementById('lname').value;
</body>
</html>
2.B) Develop a student registration form with Validation support using JavaScript
Program steps:
100vh;
}
form {
background-color:
#fff;border-radius:
8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 20px;
width: 300px;
text-align:
center;
}
h1 {
color: #333;
}
label {
display: block;
margin-bottom:
8px;color: #555;
}
input {
width: 100%;
padding: 10px;
margin-bottom:
16px;
box-sizing: border-
box; border: 1px
solid #ccc; border-
radius: 4px;
}
button { background-
color:
#4CAF50;color: white;
padding: 10px
15px;border:
none; border-
radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
#error-
messag
e
{color: red;
margin-top: 10px;
}
</style>
</head>
<body>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<button type="submit">Register</button>
<div id="error-message"></div>
</form>
<script>
function validateForm() {
var name
=
document.getElementById('name').value; var email
=
document.getElementById('email').value; var dob =
document.getElementById('dob').value;
var errorMessage = document.getElementById('error-message');
// Basic validation
if (name.trim() === '' || email.trim() === '' || dob.trim()
=== '') {errorMessage.textContent = 'All fields are
required.';
return false;
LORDS ENGINEERING COLLEGE BE VII SEMESTER 21
WEB TECHNOLOGIES LAB
// Allow form
submissionreturn true;
}
</script>
</body>
</html>
Program steps:
Output:
<!DOCTYPE html>
<htm
l
lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic To-Do List</title>
<style>
body
{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana,sans-
serif;background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content:
center;align-items:
center; height:
100vh;
}
#todo-container
{ background-color:
#fff;border-radius:
8px;
box-shadow: 0 0 10px rgba(0, 0, 0,
0.1);padding: 20px;
width: 300px;
text-align:
center;
ul {
list-style-type:
none;padding: 0;
li {
margin-bottom:
10px;display: flex;
justify-content: space-
between;align-items:
center;
}
button { background-
color:
#4CAF50;color: white;
padding: 5px
10px;border:
none; border-
radius: 4px;
cursor: pointer;
font-size: 12px;
}
button:hover {
background-color: #45a049;
}
</style>
</head
>
LORDS ENGINEERING COLLEGE BE VII SEMESTER 26
WEB TECHNOLOGIES LAB
<body
>
<div id="todo-container">
<h2>To-Do List</h2>
<input type="text" id="new-task" placeholder="New task...">
<button onclick="addTask()">Add</button>
<ul id="task-list"></ul>
</div>
<script>
function addTask() {
var newTaskInput =
document.getElementById('new-task');var taskList
= document.getElementById('task-list');
if (newTaskInput.value.trim()
=== '') {alert('Please enter a
task.'); return;
var li =
document.createElement('li');
li.innerHTML = `
<span>${newTaskInput.value}</span>
<button onclick="completeTask(this)">Complete</button>
<button onclick="deleteTask(this)">Delete</button>
`;
taskList.appendChil
d(li);
LORDS ENGINEERING COLLEGE BE VII SEMESTER 27
WEB TECHNOLOGIES LAB
newTaskInput.value
= '';
}
function
completeTask(button)
{var li =
button.parentElement;
li.style.textDecoration = 'line-through';
}
function deleteTask(button)
{ var li =
button.parentElement;
li.remove();
}
</script>
</body>
</html>
Program steps:
Output:
Module Description
Output:
Read files
Create files
Update files
Delete files
Rename files
Output:
Express is a small framework that sits on top of Node.js’s web server functionality to simplify its
APIs and add helpful new features.It makes it easier to organize your application’s functionality with
middle ware and routing; it adds helpful utilities to Node.js’s HTTP objects;it facilitates the rendering
of dynamic HTTP objects.
The express.Router() function is used to create a new router object. This function is used when you want
to create a new router object in your program to handle requests.
Syntax : express.Router( [options] )
Optional Parameters:
case-sensitive: This enables case sensitivity.
mergeParams: It preserves the req.params values from the parent router.
strict: This enables strict routing.
mergeParams Preserve the req.params values from the parent false 4.5.0+
router. If the parent and the child have conflicting
param names, the child’s value take precedence.
Program steps:
Output:
3.D) Request Parameter handling, Request Response Objects
Program steps:
The requestListener is a function that is called each time the server gets a request.
The requestListener function is passed as a parameter to the http.createServer() method.
The requestListener function handles requests from the user, and also the response back to the user
Output:
Problem Statement: Build an app that works with a RESTful api that is programmed through a
MVC architecture. Example: College Management System
Description:
MVC is an acronym for Model-View-Controller. It is a design pattern for software projects. It is used
majorly by Node developers and by C#, Ruby, PHP framework users too. In MVC pattern, application
and its development are divided into three interconnected parts. The advantage of this isit helps in
focusing on a specific part of the application name, the ways information is presented to and accepted
from, the user. It helps in allowing for efficient code reuse and the parallel development of the
application.
Model: Model represents the structure of data, the format and the constraints with which it is stored.
It maintains the data of the application. Essentially, it is the database part of the application.
View: View is what is presented to the user. Views utilize the Model and present data in a form in which
the user wants. A user can also be allowed to make changes to the data presented to the user. They
consist of static and dynamic pages which are rendered or sent to the user when the userrequests
them.
Controller: Controller controls the requests of the user and then generates appropriate response which
is fed to the viewer. Typically, the user interacts with the View, which in turn generates the appropriate
request; this request will be handled by a controller. The controller renders the appropriate view with
the model data as a response.
Following four HTTP methods are commonly used in REST based architecture.
Program steps:
Create a Project Directory
Initialize a new Node.js Project
Install Required Packages
Create Project Files
Start Building Your Project
Output:
HTTP
Sr.No. URI POST body Result
Method
Problem Statement: Create a component that displays a simple form with input fields for the
event title, start time and location, and a submit button.
Description: React is a JavaScript library for building user interfaces. React is used to build single-
page applications. React allows us to create reusable UI components.
JSX is an XML-like code which we can use when coding with React. It was developed by the team at
Facebook & is mean’t to provide a more concise syntax, helping to simplify the developer experience.
We use curly braces {} to embed the variable into our JSX expression. And within those curly braces
we could embed any valid JavaScript expression. Such as user.firstName or printName(user)
JSX allows us to write HTML elements in JavaScript and place them in the DOM without
any createElement() and/or appendChild() methods.
JSX converts HTML tags into react elements.
Output:
Output:
Problem Statement: Create an Application for student Data Base using MongoDB and React JS
Document databases store data in documents similar to JSON (JavaScript Object Notation)
objects. Each document contains pairs of fields and values. The values can typically be a variety
of types including things like strings, numbers, booleans, arrays, or objects.
Key-value databases are a simpler type of database where each item contains keys and values.
Wide-column stores store data in tables, rows, and dynamic columns.
Graph databases store data in nodes and edges. Nodes typically store information about people,
places, and things, while edges store information about the relationships between the nodes.
5.B) Creating collections, retrieving data, inserting, updating, and querying the databases
Program steps:
Create Collection
Insert Data into Collection Documents in MongoDB
Select All Documents in a Collection
Specify Conditions Using Query Operators
Output:
Fig: DB connection
Output:
Description: Use the MERN stack; you work with React to implement the presentation
layer, Express and Node to make up the middle or application layer, and MongoDB to create the
database layer.
6. Jump into the server folder that we created previously and create the server. Then, we will
initialize package.json using npm init.
Program Steps:
Use php code
Use mysql database
Use Dreamweaver tool to create code and connect frontend with backend
Use lampp services
Execute application
Output:
-----END-----