Web - Technologies PPT Unit 1
Web - Technologies PPT Unit 1
Unit 1: Contents
UNIT-I: HTML :Basic Syntax, Standard
HTML Document Structure, Basic Text Markup,
Images, Hypertext Links, Lists, Tables, Frames
Forms.
CSS: Cascading style sheets : Levels of Style
Sheets, Style Specification Formats, Selector
Forms, Property value forms, Font Properties,
List Properties, color, Alignment of Text
Introduction to HTML
• HTML is the standard markup language for Web pages.
• With HTML you can create your own Website.
• HTML is easy to learn - You will enjoy it!
• HTML consists of a series of elements
• HTML elements tell the browser how to display the
content
• HTML elements label pieces of content such as "this is a
heading", "this is a paragraph", "this is a link", etc.
HTML tags
• HTML markup tags are usually called HTML tags
• HTML tags are keywords (tag names) surrounded by
angle brackets like <html>
• HTML tags normally come in pairs like <b> and </b>
• The first tag in a pair is the start tag, the second tag is
the end tag
• The end tag is written like the start tag, with a forward
slash before the tag name
• Start and end tags are also called opening tags and
closing tags
History of HTML
Structure of HTML Page
Some Important HTML Tags
HTML Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Explanation
The DOCTYPE declaration defines the document
type
The text between <html> and </html> describes
the web page
The text between <body> and </body> is the
visible page content
The text between <h1> and </h1> is displayed as
a heading
The text between <p> and </p> is displayed as a
paragraph
What is HTML?
• HTML, otherwise known as HyperText
Markup Language, is the language used to
create Web pages
• Using HTML, you can create a Web page
with text, graphics, sound, and video.
• Hyper means we can navigate from one
web page to another page where they need
not be linear pages.
Tags
• HTML is written in the form of tags
• A tag is a keyword enclosed by pair of angle
brackets ( Example: < > )
• Where some text is placed between tags.
• HTML elements have two basic properties
Attributes
contents
More Tags...
• The opening and closing tags use the same
command except the closing tag contains
and additional forward slash /
• For example, the expression <b >
Warning </b> would cause the word
‘Warning’ to appear in bold face on a Web
page.
• There are some tags which has opening tag
but not closing tag, also known as Empty
HTML Elements.
Eg - <br>,<hr> i.e Break and Horizontal rule
Nested Tags
• Whenever you have HTML tags within other
HTML tags, you must close the nearest tag
first
• Example:
<h1> <iI> The Nation </Ii> </h1>
Structure of a Web Page
• All Web pages share a <html>
<head>
common structure
<title> Example </title>
• All Web pages should </head>
contain a pair of <body>
<HTML>, <HEAD>, This is where you would include
the text and images on your Web
<TITLE>, and <BODY> page.
tags. </body>
</html>
Comment Statements
• Comment statements are notes in the HTML
code that explain the important features of
the code
• The comments do not appear on the Web
page itself but are a useful reference to the
author of the page and other programmers
• To create a comment statement use the
<!-- Write ur comment here --> tags
HTML Elements
An HTML element is defined by a start tag,
some content, and an end tag.
HTML Elements
The HTML element is everything from the
start tag to the end tag:
<tagname>Content goes here...</tagname>
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
HTML Attributes
• All HTML elements can have attributes
• Attributes provide additional information about
elements
• Attributes are always specified in the start tag
• Attributes usually come in name/value pairs
like: name="value"
For example:
The href Attribute
The <a> tag defines a hyperlink.
The href attribute specifies the URL of the page the
link goes to:
<a href="https://www.w3schools.com">Visit W3Schools</a>
The <TITLE> Tag
• Choose the title of your Web page carefully;
The title of a Web page determines its ranking
in certain search engines
• The title will also appear on Favorite lists,
History lists, and Bookmark lists to identify
your page
Headings
<p> Please come with your <mark> Observation and Record </mark> for your WT Lab
</p>
<h6> this will display heading is small font </h6>
<small> This will display text in very small </small>
<p>My Interested Job is <del> Software</del> Government. </p>
<p>
My Interested Job is <del> Software</del> <ins>Government </ins>. </p>
<p>This is an example on <sub>subscripted</sub> text.</p>
<p>This is an example on <sup>superscripted</sup> text.</p>
</body>
</html>
Tables
• Tables can be used to display rows and columns
of data, create multi-column text, captions for
images, and sidebars
• The <table> tag is used to create a table;
the <tr> tag defines the beginning of a row while
the <td> tag defines the beginning of a cell
<th> is used to define the table heading for a cell
<thead> is used to define the heading for the entire
table
Adding a Border
• The BORDER=n attribute allows you to
add a border n pixels thick around the
table
• To make a solid border color, use the
BORDERCOLOR=“color” attribute
Creating Simple Table
<TABLE BORDER=10> • Here’s how it would
<TR>
<TD>One</TD>
look on the Web:
<TD>Two</TD>
</TR>
<TR>
<TD>Three</TD>
<TD>Four</TD>
</TR>
</TABLE>
Adjusting the Width
• When a Web browser displays a table, it often
adds extra space. To eliminate this space use
the WIDTH =n attribute in the <TABLE> and
<TD> tags
• Keep in mind - a cell cannot be smaller than its
contents, and if you make a table wider than
the browser window, users will not be able to
see parts of it.
Centering a Table
• There are two ways to center a table
– Type <TABLE ALIGN=CENTER>
– Enclose the <TABLE> tags in opening and closing
<CENTER> tags
Wrapping Text around a Table
• It is possible to wrap text around a table. This
technique is often used to keep images and captions
together within an article.
• To wrap text around a table, type <TABLE ALIGN =
LEFT> to align the table to the left while the text
flows to the right.
• Create the table using the <TR>, <TD>, and </TABLE>
tags as you normally would
Adding Space around a Table
• To add space around a table, use the
HSPACE=n and VSPACE=n attributes in the
<TABLE> tag
• Example:
<TABLE HSPACE=20 VSPACE=20>
Nesting Tables
• Create the inner table
• Create the outer table and determine which cell of
the outer table will hold the inner table
• Test both tables separately to make sure they work
• Copy the inner table into the cell of the outer table
• Don’t nest too many tables. If you find yourself doing
that, find an easier way to lay out your Web page
Changing a Cell’s Color
• To change a cell’s color, add the
BGCOLOR=“color” attribute to the <TD> tag
• Example:
<TD BGCOLOR=“blue”>
Colspan and Rowspan Attributes
<html>
<body>
<form>
First name: <br>
<input type="radio" name="gender" value="Male"“ > Male <br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other <br>
</form>
</body>
</html>
Other tags
• <input type =“ checkbox” >
• <input type =“ file”>
• <textarea rows=“5” cols=“100”>
• </textarea>
Type = Submit button attribute
<body>
<form action="a.txt">
First name:<br>
<input type="text" name="firstname“> <br>
Password:<br>
<input type="password" name="pass" ><br><br>
<input type="submit" value="Submit">
</form>
File Upload Box
<body>
<form>
<input type="file" name="fileupload"/>
</form>
</body>
Html form Elements
Some of the main elements in HTML form tag is:
• <input>
• <label>
• <select>
• <textarea>
• <button>
• <fieldset>
• <legend>
• <datalist>
• <output>
• <option>
• <optgroup>
label element
The <label> element defines a label for
several form elements. The for attribute of
the <label> tag should be equal to
the id attribute of the <input> element to
bind them together.
Syntax:
<label for="fname">First name:</label>
<input type="text" id="fname“ >
The select element
The <select> Element
• The <select> element defines a drop-down list:
Example
<label for="cars">Choose a car:</label>
<select id="cars" name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<option> element
• The <option> elements defines an option that
can be selected.
• By default, the first item in the drop-down list
is selected.
• To define a pre-selected option, add
the selected attribute to the option:
Syntax:
<option value="fiat" selected>Fiat</option>
Allow multiple selections
• Use the multiple attribute to allow the user to
select more than one value:
Syntax:
The <fieldset> and <legend> Elements
<frameset cols="70%,30%">
</frameset>
</html>
Cascading Style Sheets(CSS)
• CSS stands for Cascading Style Sheets
• Styles define how to display HTML elements
• Styles were added to HTML 4.0 to solve a
problem
• External Style Sheets can save a lot of work
• External Style Sheets are stored in CSS files
• The extension for external style sheets is .css
CSS Solved a Big Problem ?
• HTML was never intended to contain tags for
formatting a document.
• HTML was intended to define the content of a
document, like:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes
were added to the HTML 3.2 specification, it
started a nightmare for web developers.
Development of large web sites, where fonts
and color information were added to every single
page, became a long and expensive process.
To solve this problem, the World Wide Web
Consortium (W3C) created CSS.
In HTML 4.0, all formatting could be removed
from the HTML document, and stored in a
separate CSS file.All browsers support CSS today.
CSS Syntax
CSS Syntax
The CSS syntax is made up of three parts: a
selector, a property and a value:
selector { property : value ;Font-family:”times”
;color:red ; size:10; }
color: red;
text-align: right;
font-size: 20pt
The color is inherited from the external
style sheet and the text-alignment and the
font-size is replaced by the internal style
sheet.
Example on CSS
<html>
<head>
<style type="text/css">
body {background-color: yellow}
h1 {background-color: #00ff00}
h2 {background-color: transparent}
p {background-color: rgb(250,0,255)}
</style>
</head>
<body>
<h1> Java made simple </h1>
<h2> Introduction </h2>
<p> Java was invented by SunMicro … </p>
</body>
</html>
CSS Selectors
A DOM is a standard
tree structure, where each
node contains one of the
components from an XML
structure. The two most
common types of nodes are
element nodes and text
nodes. Using DOM
functions lets you create
nodes, remove nodes,
change their contents, and
traverse the node hierarchy.
Why Use a DTD (Document Type Definition)
<xsl:stylesheet version="1.0“>
<xsl:template match="/">
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
If we want to link xml style sheet
for an XML page
<?xml-
stylesheet type = "text/xsl" href = "filename.xsl"?>
XML Parsers - DOM and SAX
• DOM parser load full XML file in-memory and creates a tree
representation of XML document, while SAX is an event based
XML parser and doesn’t load whole XML document into
memory.
• If you know you have sufficient amount of memory in your
server you can choose DOM as this is faster because load
entire XML in-memory and works as tree structure which is
faster to access.
• As a thumb rule, for small and medium sized XML documents,
DOM is much faster than SAX because of in memory
management.
• As a thumb rule, for larger XML and for frequent parsing, SAX
XML parser is better because it consume less memory.
Differences
Web Technologies
Unit 3: Contents
UNIT-III: WORKING WITH DATABASE:
Getting started with JDBC , Defining ODBC,
Introduction to JDBC, Components of JDBC, JDBC
Architecture, Types of Drivers, Working with JDBC APIs,
Creating a Simple Application, Working with Prepared
Statement.
Getting Started with JDBC
1) What is JDBC?
Java Database Connectivity in short called as
JDBC. It is a java API which enables the java
programs to execute SQL statements. It is an
application programming interface that defines how
a java programmer can access the database in
tabular format from Java code using a set
of standard interfaces and classes written in the Java
programming language.
The JDBC DriverManager class defines
objects which can connect Java applications to
a JDBC driver. DriverManager has traditionally
been the backbone of the JDBC architecture. It
is quite small and simple.
JDBC Components
JDBC provides the following components
as part of the JDK.
The JDBC driver manager is the backbone of the
JDBC Driver Manager JDBC Architecture. It actually is quite small and
simple; its primary function is to connect Java
applications to the correct JDBC Driver and then get
out of the way.
• Type 2 driver uses the native code part instead of ODBC parts.
It uses the client-side libraries of the database.
• USE "vasavi";
• out.println(“Statement to be displayed”);
• out.write(“Statement to be printed”);
• out.print(Any expression );
1. DIRECTIVE
Specifies what JSP container must do.It starts
with @character within the tag.
There are 3 directive-
1. page directive,
2. include directive and
3. taglib directive.
Syntax of JSP Directive:
Index.jsp
Develop JSP program calculates factorial values for an
integer number, while the input is taken from an
HTML form.
Exercise 8:Develop JSP program shows a Sample Order Form
Catalog.jsp
JSP IMPLICIT OBJECTS
There are 9 jsp
implicit objects. These
objects are created by
the web container that
is available to all the jsp
pages. The available
implicit objects are out,
request, config, session,
application etc. A list of
the 9 implicit objects is
given below:
1) JSP out implicit object
For example:
If we create one web site with website name, the same website
name should be re-used for all the web pages hence we try to gather
that information using ServletContext object.
getServletContext.getInitParameter(“Name”)
6) Session Tracking Object
In JSP, session is an implicit object of type
HttpSession.The Java developer can use this object to
set,get or remove attribute or to get session
information.
For Example
session.setAttribute("user",name);
7)pageContext implicit object
pageContext extends JspContext to contribute helpful
context details while JSP technology is applied in a Servlet
environment. A PageContext is an instance that gives access to
all the namespaces related to a JSP page, gives access to some
page attributes and a layer over the application details. Implicit
objects are connected to the pageContext consequently.
8)page implicit Object
In JSP, page is an implicit object of type
Object class.This object is assigned to the
reference of auto generated servlet class. It is
written as:
Object page=this;
9)Jsp exception implicit object
The exception is
By errorPage and isErrorPage attributes of
normally an object that is
thrown at runtime. page directive
Exception Handling is the
By <error-page> element in web.xml file
process to handle the
runtime errors. There may
occur exception any time in
your web application. So
handling exceptions is a
safer side for the web
developer. In JSP, there are
two ways to perform
exception handling:
DATABASE ACCESS & SESSION TRACKING
• Session simply means a
• For connecting the JSP
particular interval of time.
pages with My-SQL we need
• Session Tracking is a way to
to use JDBC connectivity
maintain state (data) of an user.
It is also known as session with Type 4 Driver. Once
management in servlet. JDBC type 4 driver is
• In general we can use any type constructed now the JSP
of database for connecting JSP pages can be easily
page to store and retrieve the connected with the
data from centralized data database
storage location. Here we are
going to use MY-SQL as back
end database to store and
retrieve the information.
Session Tracking
• Session simply means a particular
interval of time.
• Session Tracking is a way to
maintain state (data) of an user. It
is also known as session
management in servlet.
• Http protocol is a stateless so we
need to maintain state using
session tracking techniques. Each
time user requests to the server,
server treats the request as the
new request. So we need to
maintain the state of an user to
recognize to particular user.
Database Connection Using My-SQL In JSP
Web Technologies
Unit 5: Contents
From this location you can view the newest and most
popular modules as well as search for specific packages
https://npmjs.com
Home Page for NPM Registry
2) Create Server
For Example
I.e Step 1 and Step 2 are stored in one file and save the file with
extension .js
ng new my-first-app
• Navigate to your first app.
cd my-first-app
• Start your server to run app.
ng serve
About Data Binding
Data binding is the synchronization of
data between business logic and view of
the application. It serves as a bridge
between two components of angular that is
model part and view part. Data Binding is
automatic and provides a way to wire the
two important part of an application that is
the UI and application data.
How data binding is possible in
angular
The directive in AngularJS used to bind the value
of the input field (such as text field, text area) to the
HTML element is ng-model. An ng-model directive is
used to perform data binding in angular. We don’t have
to write extra code to link the model part with view
part by adding few snippets of code we can bind the
data with the HTML control.
In the Angular JS we will be using ng-model and
ng-bind for performing the binding operations.
Data Binding
There are two types of data binding present in
Angular Js. They are as follows:
1) One-way Data Binding
2) Two –Way Data Binding
Now lets see the difference between one-way and
two-way data binding .
1. One Way data binding
Two way data binding
1. Value
2. Factory
3. Service
4. Provider
5. Constant
1) Value
Value is an object. It can be a number,
string or javascript object. It is used to pass the
value to controller, service or factories in config
or run phase.
Components
Templat
e
Class
MetaDa
ta
Sample Program
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.
min.js"></script>
<body>
<div ng-app="" >
<p>Enter Some text here :</p>
<p>Name: <input type="text" ng-model="language"></p>
<p>Hello : {{ language }}</p>
</div>
</body>
</html>
Expected Output : When internet
is not available
When u connect internet
Sample application using ng-init
<!DOCTYPE html>
directive
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.
min.js"></script>
<body>
<div ng-app="" ng-init="quantity=1;price=5">
<h2>Cost Calculator</h2>
Quantity: <input type="number" ng-model="quantity">
Price: <input type="number" ng-model="price">
<p><b>Total in dollar:</b> {{quantity * price}}</p>
</div>
</body>
Output
Sample application using ng-repeat
<!DOCTYPE html>
directive
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.mi
n.js"></script>
<body>
<div ng-app="" ng-init="names=['Kumar','Kiran','Rajesh']">
<p>Example on ng-repeat:</p>
<ul>
<li ng-repeat="x in names">
{{ x }}
</li>
</ul>
Output
WT LAB 1 to 10
PROGRAMS
Prepare these same program to ur
Theory Exams also
Exercise 1:
Design HTML fundamental Concepts.
• Headings
• Links
• Paragraph
• Images
• Tables
Example on Headings
1) Headings
The headings will be declared under <hn> Content to be added here…</hn> ,
where n can be value range from 1 to 6.
<!DOCTYPE html>
<html>
<head>
<title> My First Example on Headings </title>
</head>
<body>
<h1>My First Heading with H1 Size </h1>
<h2>My First Heading with H2 Size </h2>
<h3>My First Heading with H3 Size </h3>
<h4>My First Heading with H4 Size </h4>
<h5>My First Heading with H5 Size </h5>
<h6>My First Heading with H6 Size </h6>
</body>
</html>
2) Links
The HTML <a> tag defines a hyperlink. It has the following syntax:
<a href="url">link text</a>
Example program
<!DOCTYPE html>
<html>
<head>
<title> Example on HTML Links </title>
</head>
<body>
<h1>HTML Links</h1>
<p><a href="https://www.w3schools.com/">Click Here for More
Information !</a></p>
</body>
</html>
3)Paragraph
<p> is the tag which is used to display the content in paragraph manner < /p>
Example program
<!DOCTYPE html>
<html>
<head>
<title> Example on HTML Paragraph </title>
</head>
<body>
<p> This is one of the main tag
Which is used to display the content in paragraph manner
Here we can give either single line or multiple lines and display
whole content in paragraph
</p>
</body>
</html>
4) Images
<img src= ” is the tag which is used to link images “ >
Example
<!DOCTYPE html>
<html>
<body>
<h2>HTML Image</h2>
<img src=“img_girl.jpg" alt="Girl in a jacket ”
width="500" height="600">
</body>
</html>
5) tables
Example on rowspan and colspan
Exercise 2: Design HTML fundamental
constructs. (i) Frames (ii) Forms and
HTML controls
i)Frames
ii) Html Forms
Exercise 3: Design Cascading style
sheets
(i) Internal
(ii) External
(iii) Inline
1) Internal Style Sheet
2)Inline style sheet
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;text-align:center;">
This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
</body>
</html>
3)External Style Sheet(External.html)
abc.css file
Element Selectors
<!DOCTYPE html>
<html>
<head>
<style>
p.intro {
background-color: yellow;
}</style>
</head>
<body>
<h1>Demo of the element.class selector</h1>
<div class="intro">
<p>My name is Donald.</p>
<p>I live in Duckburg.</p>
</div>
<p>My best friend is Mickey.</p>
<p class="intro">My best friend is Mickey.</p></body></html>
Exercise 4
Exercise 4:
Write an XML file which will display the Book
information which includes the following: (i) Title of the book
(ii) Author Name (iii) ISBN number (iv) Publisher name (v)
Edition (vi) Price
(a) Write a Document Type Definition (DTD) to validate
the above XML file.
(b) Write a XML Schema Definition (XSD)
Sample DTD for Book
Book.xml
Contd..
Contd..
book.xsl
Contd…
Lab Exercise 5:Create a simple JSP to print the current
Date and Time.
Lab Exercise 6:Create a simple JSP a) Display current IP-
Address of the System b) Find out the Square root for a
Number
6 b) Find out the Square root for a Number
Lab Exercise 7:Develop JSP program calculates factorial values for an integer
number, while the input is taken from an HTML form.
Index.jsp
Exercise 7: Develop JSP program calculates factorial values
for an integer number, while the input is taken from an
HTML form.
Exercise 8:Develop JSP program shows a Sample Order Form
Catalog.jsp
Exercise 9:
a) MYSQL connectivity using Type 4 Driver for Data
Retrieval
Before executing the program,just try to create
database with following tables
• USE "vasavi";