Unit 1 - Web & Adv Java
Unit 1 - Web & Adv Java
The World Wide Web ("WWW", "W3" or simply "the Web") is a global information
medium that users can access via computers connected to the Internet.
Tim Berners-Lee invented the World Wide Web while working at CERN in 1989.
He proposed a "universal linked information system" using several concepts and
technologies, the most fundamental of which was the connections that existed
between information.
He developed the first web server, the first web browser, and a document
formatting protocol, called Hypertext Markup Language (HTML).
After publishing the markup language in 1991, and releasing the browser source
code for public use in 1993, many other web browsers were soon developed,
with Marc Andreessen's Mosaic (later Netscape Navigator), being particularly
easy to use and install, and often credited with sparking the Internet boom of
the 1990s.
It was a graphical browser which ran on several popular office and home
computers, bringing multimedia content to non-technical users by including
images and text on the same page.
Websites for use by the general public began to emerge in 1993–94. This spurred
competition in server and browser software, highlighted in the Browser wars
which was initially dominated by Netscape Navigator and Internet Explorer.
The features of HTML evolved over time, leading to HTML version 2 in 1995,
HTML3 and HTML4 in 1997, and HTML5 in 2014.
1
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
The language was extended with advanced formatting in Cascading Style Sheets
(CSS) and with programming capability by JavaScript.
AJAX programming delivered dynamic content to users, which sparked a new era
in Web design, styled Web 2.0.
The use of social media, becoming common-place in the 2010s, allowed users to
compose multimedia content without programming skills, making the Web
ubiquitous in every-day life.
“For many decades we have been browsing our favorite websites on the internet
and getting a quick response whenever we want… but do you ever try to know
how each part of the application works together and how is the request being
processed behind the scenes?”
When you’re building an application, you need to remember three principles in your
mind…
problems.
● From a business aspect, your web application should stay aligned with its
product/market fit
Do you know that there is a difference between websites and web applications?
The web application is a program that runs on a browser and it has mainly three
formal characteristics.
2
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
information
If we talk about the website then traditionally it’s just a combination of static
pages.
how the connection is established between the client and the server.
other
○ When you type the URL in your web browser and hit enter, the web
browser needs to know the address of the server where the page is
located.
3
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
○ After that browser sends the request to the found IP address using the
HTTPS protocol.
○ If you already have visited [Link] earlier from the same browser,
○ In the next step, the web server sends the request to the storage area to
locate the page and all data that follows with it.
○ Here the Business logic (also called Domain Logic and Application Logic)
data is accessed.
data.
○ The web page (graphical interface) for any website which is displayed
○ Here you see all the UI and UX components to access the information.
Web application architectural patterns are separated into many different layers
or tiers which is called Multi- or Three-Tier Architecture. You can easily replace
4
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Presentation Layer:
● This layer is accessible to the client via a browser and it includes user interface
● UI components are built with HTML, CSS, and JavaScript (and its frameworks
or library) where each of them plays a different role in building the user
interface.
Business Layer:
5
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
● It accepts the user’s request from the browser, processes it, and regulates the
● You can take the example of booking a hotel on a website. A traveler will go
through a sequence of events to book the hotel room and the whole workflow
Persistence Layer:
● This layer collects all the data calls and provides access to the persistent
storage of an application.
● The business layer is closely attached to the persistence layer, so the logic
knows which database to talk to and the process of retrieving data becomes
more optimized.
Some other parts of the web application which are separated from the main layers
management, and security. It affects all parts of the system but should
6
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
applications that only include the most required elements and information to
page rather than loading a new page from the server for each action performed by
the user.
● AJAX, Asynchronous JavaScript, and XML are mainly used for page
communication.
● Users can continue the interaction with the page while the contents are
2. Microservices:
● These are small and lightweight services that execute specific, single
functionality.
● The components in the applications are not dependent on each other, so there
language.
7
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
3. Serverless Architectures:
● The advantage of this approach is that it allows the application to execute the
tasks.
manage or support the servers and the hardware they have developed the
Overview of HTTP
What is HyperText?
● Whenever a web user opens their web browser, the user indirectly uses
HTTP.
8
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
● First of all, whenever we want to open any website we first open a web
browser. After that we will type the URL of that website (e.g.,
[Link] ).
● Then DNS first checks records for this URL in their database, and then
DNS will return the IP address to the web browser corresponding to this
URL. Now the browser is able to send requests to the actual server.
● After the server sends data to the client, the connection will be closed.
9
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
● HTTP Version
● URL
● HTTP Method
● HTTP Body
HTTP Request Headers generally store information in the form of key-value and
must be present in each HTTP Request. The use of this Request Header is to
provide core information about the client’s information, etc.
HTTP Request Body simply contains the information that has to be transferred.
HTTP Request has the information or data to be sent to these browsers.
HTTP Method
HTTP Methods are simply HTTP Verb. In spite of being present so many HTTP
Methods, the most common HTTP Methods are HTTP GET and HTTP POST.
These two are generally used in HTTP cases. In HTTP GET, the information is
received in the form of a website.
HTTP Response is simply the answer to what a Server gets when the request is
raised. There are various things contained in HTTP Response, some of them are
listed below.
● HTTP Headers
● HTTP Body
10
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
HTTP Response headers are simply like an HTTP Request where it has that work
to send some important files and data to the HTTP Response Body.
HTTP Responses are the responses that are received successfully upon the
request. Generally, it comes under the requests generated by the web. In most
cases, the request is to transfer the HTML data into a webpage.
HTTP Status Codes are the 3-digit codes that tell the message or simply tell us
about the HTTP Request whether it has been completed or not. There are simply
5 types of status codes.
● Redirects (300–399)
11
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
12
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<!DOCTYPE html>
<html>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
13
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Bigger Headings
title:
<head>
<title>A Meaningful Page Title</title>
</head>
style:
<style>
body {background-color: powderblue;}
h1 {color: red;}
p {color: blue;}
</style>
14
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Link:
<head>
<link rel="stylesheet" href="[Link]">
</head>
meta:
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
</head>
15
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
script:
<script>
function myFunction() {
[Link]("demo").innerHTML = "Hello
JavaScript!";
}
</script>
Base:
The <base> element specifies the base URL and/or target for all relative
URLs in a page.
The <base> tag must have either an href or a target attribute present, or
both.
Example:
<head>
<base href="[Link] target="_blank">
</head>
<body>
<img src="images/[Link]" width="24" height="39"
alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>
The HTML <a> tag defines a hyperlink. It has the following syntax:
16
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Example
<!DOCTYPE html>
<html>
<body>
<h1>HTML Links</h1>
<p><a href="[Link] [Link]!</a></p>
</body>
</html>
By default, the linked page will be displayed in the current browser window. To
change this, you must specify another target for the link.
Example:
Both examples above are using an absolute URL (a full web address) in the href
attribute.
A local link (a link to a page within the same website) is specified with a relative
URL (without the "[Link] part):
17
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<h2>Absolute URLs</h2>
<p><a href="[Link]
<p><a href="[Link]
<h2>Relative URLs</h2>
<a href="[Link]">
<img src="[Link]" alt="HTML tutorial" style="width:42px;height:42px;">
</a>
Button as a Link
Link Titles
Creating a Paragraph
Example:
<!DOCTYPE html>
<html>
18
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
Output:
This is a paragraph.
This is a paragraph.
This is a paragraph.
HTML Display
Example:
<p>
This paragraph
ignores it.
</p>
19
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Image Maps
The HTML <map> tag defines an image map. An image map is an image with
clickable areas. The areas are defined with one or more <area> tags.
<!DOCTYPE html>
<html>
<body>
<h2>Image Maps</h2>
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer"
href="[Link]">
</map>
</body>
</html>
The idea behind an image map is that you should be able to perform different
actions depending on where in the image you click.
To create an image map you need an image, and some HTML code that
describes the clickable areas.
20
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
The Image
The image is inserted using the <img> tag. The only difference from other
images is that you must add a usemap attribute:
The usemap value starts with a hash tag # followed by the name of the image
map, and is used to create a relationship between the image and the image
map.
The <map> element is used to create an image map, and is linked to the
image by using the required name attribute:
<map name="workmap">
The name attribute must have the same value as the <img>'s usemap attribute.
The Areas
Shape
You must define the shape of the clickable area, and you can choose one of
these values:
You must also define some coordinates to be able to place the clickable area
onto the image.
21
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Shape="rect"
The coordinates for shape="rect" come in pairs, one for the x-axis and one
for the y-axis.
So, the coordinates 34,44 is located 34 pixels from the left margin and 44
pixels from the top:
The coordinates 270,350 is located 270 pixels from the left margin and 350
pixels from the top:
22
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
23
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Table Cells
Table Cell are the building blocks for defining the Table. It is denoted with
<td> as a start tag & </td> as a end tag.
Table Rows
The rows can be formed with the help of combination of Table Cells. It is
denoted by <tr> and </tr> tag as a start & end tags.
24
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Table Headers
The Headers are generally use to provide the Heading. The Table Headers
can also be used to add the heading to the Table. This contains the <th> &
</th> tags.
25
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
26
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
27
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
28
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
29
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
30
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
31
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Example: Explains the border space property to make the space between
the Table cells.
32
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
33
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
34
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
35
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
36
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
37
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
Syntax
38
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
39
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
40
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
41
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
42
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
43
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
44
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
45
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
46
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
HTML - Frames
HTML frames are used to divide your browser window into multiple sections
where each section can load a separate HTML document independently. A
collection of frames in the browser window is known as a frameset. The
window is divided into frames in a similar way the tables are organized: into
rows and columns.
[Link]
<html>
<head>
<title>Frames</title>
</head>
<frameset cols="50% ,50%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
<noframes></noframes>
</html>
47
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
[Link]
<html>
<head>
<title>Frames</title>
</head>
<body>
<h1 align="center">Frame 1</h1>
<h4 align="center">This is Frame 1</h4>
</body>
</html>
[Link]
<html>
<head>
<title>Frames</title>
</head>
<body>
<h1 align="center">Frame 2</h1>
<h4 align="center">This is Frame 2</h4>
</body>
</html>
[Link]
<html>
<head>
<title>Frames</title>
</head>
<body>
<h1 align="center">Frame 3</h1>
<h4 align="center">This is Frame 3</h4>
</body>
</html>
[Link]
<html>
<head>
<title>Frames</title>
</head>
<frameset rows="33%,33%,33%">
<frame src="[Link]">
48
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<frame src="[Link]">
<frame src="[Link]">
</frameset>
<noframes></noframes>
</html>
[Link]
<html>
<head>
<title>Frames</title>
</head>
<frameset cols="33%,33%,33%">
<frame src="[Link]">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
<noframes></noframes>
</html>
49
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
frame_border_thickness.html
<html>
<head>
<title>Frames</title>
</head>
<frameset cols="33%,33%,33%" frameborder="1" framespacing="10">
<frame src="[Link]">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
<noframes></noframes>
</html>
50
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
The basic purpose of an html form is to allow user to enter the data on
one end and then send the data on other end through webserver.
<html>
<head>
<title>
Creating HTML Form
</title
</head>
<body>
<form>
First Name:
<input type="text" name="firstname">
<br>
Last Name:
<input type="text" name="lastname">
<br>
<input type="submit" value="SUBMIT">
</form>
</body>
</html>
51
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<html>
<head>
<title>
Creating HTML Form
</title
</head>
<body>
<form action="[Link]" method="post">
First Name:
<input type="text" name="firstname">
<br>
Last Name:
<input type="text" name="lastname">
<br>
<input type="submit" value="SUBMIT">
</form>
<p>
If you click the <b><u>"SUBMIT"</u></b> button you will be redirected
to the
<b><u>[Link]</u></b> page.
</p>
</body>
</html>
52
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<html>
<head>
<title>
Adding Text Field
53
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
</title>
</head>
<body>
<form action="">
First name:
<input type="text" name="firstname" size="30" />
<br />
Last name:
<input type="text" name="lastname" size="30" />
</form>
</body>
</html>
ADDING BUTTON:
<html>
<head>
<title>
Adding Button
</title>
</head>
<body>
<form action="">
<input type="button" value="Hello World!">
</form>
</body>
</html>
54
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
ADDING CHECKBOX:
<html>
<head>
<title>
Adding Check Box
</title>
</head>
<body>
<form action="">
<b>I love reading:</b>
<input type="checkbox" name="hobby" value="books">
</br>
<b>I love playing:</b>
<input type="checkbox" name="hobby" value="play" checked>
</br>
<b>I love driving:</b>
<input type="checkbox" name="hobby" value="drive">
</form>
</body>
</html>
55
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
YES:
<input type="radio" name="poll" value="yes"/>
</br>
NO:
<input type="radio" name="poll" value="no"/>
</form>
</body>
</html>
56
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<html>
<head>
<title>
Adding Reset Button
</title>
</head>
<body>
<form action="[Link]" method="post">
User Name:
<input type="text" size="30"/>
</br>
Password:
<input type="password" size="30"/>
</br>
<input type="submit" Value="SUBMIT">
<input type="reset">
</form>
</body>
</html>
<html>
<head>
<title>
Adding Textarea
</title>
</head>
<body>
57
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<form>
<textarea rows="10" cols="30">
This is an example of text area on the Web page. A user can input text
in this
area.
</textarea>
</form>
</body>
</html>
<html>
<head>
<title>
Adding a Selection Control
</title>
</head>
<body>
<form>
<select>
<optgroup label="General hobby">
<option value ="playing">Playing</option>
<option value ="music">Music</option>
</optgroup>
<optgroup label="Educational hobby">
<option value ="stamp collection">Stamp Collection</option>
<option value ="reading">Reading</option>
58
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
</optgroup>
</select>
</form>
</body>
</html>
59
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<html>
<head>
<title>Inline Styles</title>
</head>
<body>
<table border="1">
<caption><h2>Student Details</h2></caption>
<th style="background-color: #800000">Name</th>
<th style="background-color: #800000">Date of Birth</th>
<th style="background-color: #800000">Address</th>
<tr>
<td style="background-color: #808080">Sumit Saxena</td>
<td style="background-color: #808080">15-03- 1983</td>
<td style="background-color: #808080">Flat No.303, Shipra
Suncity,
Ghaziabad</td>
</tr>
<tr>
<td style="background-color: #008000">Amitabh Kumar</td>
<td style="background-color: #008000">22-02- 1984</td>
<td style="background-color: #008000">[Link]- 125, Kalkaji,
Delhi</td>
</tr>
<tr>
<td style="background-color: #00ff00">Rohit Jandial</td>
<td style="background-color: #00ff00">05-07- 1983</td>
<td style="background-color: #00ff00">Flat No- 324, South Ext,
Delhi</td>
</tr>
<tr>
<td style="background-color: #808000">Avantika Srivastava</td>
<td style="background-color: #808000">10-12- 1984</td>
<td style="background-color: #808000">[Link]-541, Vikas Puri,
Delhi</td>
</tr>
60
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
</table>
</body>
</html>
Output:
61
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
[Link]
62
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
<html>
<head>
<title>Multiple Style Sheets</title>
<link rel="stylesheet" type="text/css" href="[Link]">
<link rel="stylesheet" type="text/css" href="[Link]">
<link rel="stylesheet" type="text/css" href="[Link]">
</head>
<body>
<h1>Multiple Style Sheet Example</h1>
<a href= [Link] target="_blank">
<h2>Page 1</h2>
<a href= [Link] target="_blank">
<h2>Page 2</h2>
</body>
</html>
63
Web Tech & Adv Java – UNIT 1
MIIT – 2nd year MCA (HMA)
64