Web Technology Unit 1 Notes
Web Technology Unit 1 Notes
Renu Prasad
UNIT 1
1. Introduction to Web Development and Strategies
Web Development is the process of creating and maintaining websites or web applications
that are accessible through the internet or an intranet. It involves several disciplines,
including web design, web content development, client-side/server-side scripting, and
network security configuration.
Frontend Development: Focuses on what users interact with directly in their browsers. It
involves designing the look, feel, and behavior of the website or application using HTML,
CSS, and JavaScript.
Backend Development: Focuses on server-side components that users don't directly interact
with. This involves creating and managing servers, databases, application logic, and APIs that
the frontend communicates with.
HTML (HyperText Markup Language): The standard language for creating and structuring
content on the web.
CSS (Cascading Style Sheets): Used for styling and laying out web pages, including design,
colors, fonts, and layout.
JavaScript: A programming language that enables interactive web pages. It's used for client-
side scripting to make web pages dynamic.
Backend Languages: Server-side languages like Python, Ruby, PHP, Java, and Node.js are
used for backend development.
Databases: Systems like MySQL, PostgreSQL, MongoDB, and Firebase store and manage
data for websites and applications.
Developing a successful website or web application requires careful planning and strategic
execution. Here are some core strategies:
Protocols are rules that govern communication over the internet. Key protocols
include:
o HTTP/HTTPS: Protocols used for transmitting web pages.
o FTP: Used for transferring files.
o TCP/IP: Foundational protocols for networking and data transmission.
o DNS: Translates domain names into IP addresses.
Involves creating and managing code that makes up web applications, including:
o Frontend Development: Involves HTML, CSS, JavaScript.
o Backend Development: Involves server-side languages (e.g., Python, PHP,
Java) and databases.
o Full-stack Development: Combination of both frontend and backend.
This involves understanding how devices connect to networks, including the use of
modems, routers, and ISPs (Internet Service Providers).
Internet Services include email, file sharing, cloud storage, and more.
Tools can range from browsers and search engines to web development tools like
IDEs and code editors.
HTML (Hypertext Markup Language) is the standard language for creating web
pages. Some key elements include:
o Lists: <ul>, <ol> for unordered and ordered lists.
o Tables: <table>, <tr>, <td> for displaying tabular data.
o Images: <img> for embedding images.
o Frames: <iframe> for embedding another webpage.
o Forms: <form>, <input>, <button> for user input and interaction.
HTML (Hypertext Markup Language) is the standard language used to create and design
webpages. It uses a series of tags and elements to define the structure and content of a
webpage. Let's start with some basic HTML coding concepts and examples.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Webpage</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is my first webpage using HTML.</p>
</body>
</html>
:
1. <!DOCTYPE html>: Declares the document type and version of HTML (HTML5 in this case).
2. <html lang="en">: The root element that wraps all the content on the page. The lang
attribute specifies the language of the document.
3. <head>: Contains meta-information about the document, such as its character set, title, and
links to stylesheets or scripts.
4. <meta charset="UTF-8">: Sets the character encoding for the document.
5. <meta name="viewport" content="width=device-width, initial-
scale=1.0">: Ensures the page is responsive and scales properly on different devices.
6. <title>: Sets the title of the webpage, which appears in the browser tab.
7. <body>: Contains the content of the webpage, such as headings, paragraphs, images, etc.
Here are some common HTML tags you might use frequently:
<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Smaller Heading</h3>
Paragraphs (<p>):
Links (<a>):
Images (<img>):
Lists:
o Unordered List (<ul> and <li>):
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Frames
Frames in HTML were used to divide the browser window into multiple sections, where
each section could load a separate HTML document. This allowed for the simultaneous
display of multiple pages within a single window, creating a kind of "window within a
window" effect.
1. Frameset Element: The <frameset> element was used to define a set of frames. Instead of
the <body> element, the <frameset> element was used to organize the window into
different frames.
2. Frame Element: The <frame> element was used within the <frameset> to specify the
properties of each frame, such as which HTML document to display.
3. No longer recommended: HTML frames are considered an outdated technology. They were
deprecated in HTML 4.01 and are not supported in HTML5. Modern web design uses
techniques like CSS and JavaScript for layouts and dynamic content.
Here is an example that shows how frames were used in older versions of HTML:
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames Example</title>
</head>
<frameset cols="30%, 70%">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</html>
<frameset cols="30%, 70%">: The <frameset> tag replaces the <body> tag. The
cols attribute defines the number and size of columns in the frameset. In this example, two
columns are created: the first frame takes up 30% of the width, and the second takes up
70%.
<frame src="menu.html">: Loads the menu.html file into the first frame.
<frame src="content.html">: Loads the content.html file into the second frame.
Accessibility: Frames can be challenging for screen readers and other assistive technologies.
Search Engine Optimization (SEO): Content within frames was not always indexed correctly
by search engines.
Usability: Frames can cause navigation issues, such as bookmarking problems and back
button behavior.
Forms:
he <form> tag in HTML is used to create a form that allows users to input data and send it to
a server. Forms are commonly used for user registration, login pages, search boxes, feedback
forms, and other interactive elements.
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
action: Specifies the URL where the form data should be sent when the form is
submitted.
method: Determines how the form data will be sent to the server. Common values are:
o "get": Appends form data to the URL in name/value pairs. Typically used for
form submissions where data is not sensitive (like search queries).
o "post": Sends form data as an HTTP POST transaction. Used when dealing
with sensitive information (like passwords) or large amounts of data.
enctype: Specifies how the form data should be encoded when submitted. The
default is "application/x-www-form-urlencoded". Use "multipart/form-data"
when uploading files.
target: Specifies where to display the response after form submission (e.g., _blank
for a new window or tab).
Form Elements
Inside the <form> tag, you can use various elements to collect user input:
<input>: For different types of data (text, password, email, checkbox, radio, file, etc.)
<textarea>: For multi-line text input.
<button>: For clickable buttons.
<select> and <option>: For dropdown lists.
<label>: To provide labels for input elements.
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br><br>
<label for="country">Country:</label>
<select id="country" name="country">
<option value="us">United States</option>
<option value="ca">Canada</option>
<option value="uk">United Kingdom</option>
</select><br><br>
1. Self-descriptive Structure: XML uses tags to define the structure of the data. Each
tag has a name that describes its content, making the data self-descriptive.
2. Hierarchical Structure: XML data is organized in a tree-like structure with a root
element and nested child elements, allowing for complex data representations.
3. Platform Independent: XML is platform-independent, which means it can be used
across different operating systems and applications.
4. Custom Tags: Unlike HTML, XML allows users to define their own tags, making it
highly extensible and suitable for a wide range of applications.
5. Unicode Support: XML supports Unicode, allowing for the representation of text in
most of the world's writing systems.
<?xml ... ?>: The XML declaration, which defines the version and encoding of the
XML document.
<note>: The root element, which contains all other elements.
<to>, <from>, <heading>, <body>: Child elements that store data.
Purpose of DTD
Validation: Ensures that XML documents are well-formed and adhere to a specific structure.
Interoperability: Provides a common format, making it easier to share and understand XML
documents between different systems or applications.
Consistency: Helps maintain uniformity in the structure and content of XML documents.
Types of DTD
1. Internal DTD: The DTD is declared within the XML document itself.
2. External DTD: The DTD is declared in a separate file and referenced within the XML
document.
<!DOCTYPE note [...]>: The <!DOCTYPE> declaration specifies the DTD for the
document.
<!ELEMENT>: Defines an element. For example, <!ELEMENT note (to, from,
heading, body)> defines that the note element must contain to, from, heading, and
body elements.
(#PCDATA): Denotes that the element contains parsed character data (text).
2. External DTD
An external DTD is stored in a separate file (e.g., note.dtd) and is referenced within the
XML document:
XML Schema (often referred to as XSD for XML Schema Definition) is a more advanced
and powerful way to define the structure, content, and data types of an XML document
compared to a DTD. XML Schema is written in XML, which means it is extensible, supports
data types, and can be validated using standard XML tools.
Here is a simple example of an XML Schema that defines the structure of an XML document:
<note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="note.xsd">
<to>Alice</to>
<from>Bob</from>
<heading>Reminder</heading>
</note>
</xs:schema>
<xs:schema>: The root element of an XML Schema. It defines the schema and its
namespace.
<xs:element>: Declares an element. For example, <xs:element name="note">
declares the note element as the root.
<xs:complexType>: Defines a complex element that can contain other elements.
<xs:sequence>: Specifies that the child elements must appear in the order defined.
XML Schema supports several built-in data types like xs:string, xs:integer, xs:decimal,
xs:boolean, xs:date, etc. It also allows for the creation of custom data types.
</xs:schema>
type="xs:date": Specifies that the date element must conform to the date format (YYYY-
MM-DD).
Attributes can also be defined in an XML Schema using the <xs:attribute> tag
</xs:schema>
<xs:attribute>: Declares an attribute for an element. In this example, the note element
has a date attribute that is required (use="required").
Rich Data Type Support: XML Schema offers more data types and better control over data
formats.
Namespace Support: Allows the use of XML namespaces for better data management.
Stronger Validation: Provides more comprehensive validation rules and constraints.
Extensibility: Can be extended and reused across different XML documents
When an XML document is loaded into memory, it is represented as a tree with a hierarchical
structure:
Document
└── Element: note
├── Element: to
│ └── Text: "Alice"
├── Element: from
│ └── Text: "Bob"
├── Element: heading
│ └── Text: "Reminder"
└── Element: body
└── Text: "Don't forget our meeting tomorrow at 10 AM."
An XML Parser is a software tool or library that reads XML documents and
provides a way for programs to access and manipulate the document's content and structure.
XML parsers ensure that the XML document is well-formed and optionally validate it against
a specified schema (like DTD or XML Schema).
1. DOM (Document Object Model) Parser: Loads the entire XML document into
memory and represents it as a tree structure (a hierarchy of nodes). It provides a way
to traverse and manipulate the XML data. This is useful for scenarios where random
access to the XML elements is required, but it can be memory-intensive for large
documents.
2. SAX (Simple API for XML) Parser: A stream-based parser that reads the XML
document sequentially, element by element, and triggers events (like start element,
end element, etc.). SAX parsers do not load the entire document into memory, making
them more suitable for large XML files where only a small portion of the data is
needed at any time.
1. DOM Parser
Process: Reads the entire XML document, creates an in-memory tree structure, and exposes
methods to access and manipulate elements.
Use Cases: Suitable for small to medium-sized XML documents where you need to
frequently access different parts of the document or modify the document structure.
2. SAX Parser
Process: Reads the XML document sequentially and triggers events (like start element, end
element, characters, etc.) while parsing. It does not build an in-memory tree structure.
Use Cases: Suitable for large XML documents or when memory efficiency is crucial, and only
a portion of the XML needs to be processed.