WT Complete Notes
WT Complete Notes
rd
3 Year
Branch: CSE/IT
Subject: Web Technology (BCS- 502)
ENCLOSURES:
BRANCH Units S. No. FACULTY NAME
Unit-1 1 Mr. Sachin Kumar Sonker
Unit-2 2 Mr. Sachin Kumar Sonker
CSE/AIML/IT Unit-3 3 Mr. Sachin Kumar Sonker
Unit-4 4 Mr. Ajai Kumar Maurya
Unit-5 5 Mr. Sachin Kumar Sonker
Note: If you have any doubts or need further clarification on any topics, contact to the subject
coordinator.
Unit-1
Unit- I Introduction and Web Development Strategies
History of WWW:
WWW is created by Sir Tim Berners Lee in 1989 at CERN in Geneva.
In 1990, the first text only browsers were setup and CERN scientist could access hypertext
files and other information at CERN. HTML was based on a subset of the standard generalized
markup language (SGML). To transfer HTML document to remote sites a new protocol was
devised called HTTP (Hyper Text Transfer Protocol).
In the fall of 1991, conference goes around the world started hearing about the promise but
sparks still were not flying.
In 1993, there are only about 50 websites world wide. A browser that allowed user to take
advantage of the web’s graphical capabilities was developed at the National center for Super
Computing application (NCSA). NCSA called the browser Mosaic.
HTTP: HTTP is the primary protocol used to distribute information on the web.
Initial HTTP 0.9 does not allow for content typing and does not have provisions for supplying
meta-information.
Content Typing: To identify the type of data being transferred.
Meta Information: It is supplemental data, such as environment variables that identify the
client’s computer Current version is HTTP 1.0
TCP/IP: It is a set of rules that an application can use to package its information for sending
across the networks of networks.
FTP: It is used to transfer the files over networks.
E-Mail: It is a method of exchanging digital messages across the Internet or other computer
networks.
Telnet: Telnet lets you remotely log into another system and browse files and directories on that
remote system.
3. Website: A website is simply a collection of interlinked web pages.
Classification: A. Corporate Website B. Individual website
A. Corporate Website:
i. In this, there is certain no. of persons, who develop their website for a particular organization.
ii. The corporate website are formed when group of people have common interest and objective.
iii. The purpose of this website is to convey the information of organization to all over the world.
B. Individual website: It is just like profile management system. In this type of website an
individual wants to develop website for h-projection, career growth etc.
4. Cyber Laws: Cyber law is a term used to describe the legal issues related to use of
communication technology, particularly “cyberspace” i.e. Internet.
Indian and International Cyber Law: Cyber Laws are formed by the government to prevent the
internet crime. These crimes could be hacking, threat on internet, denial of services etc.
Cyberspace includes computer, computer networks, internet data, software etc.
i. Data Protection and Privacy Law: This is due to the nature of the internet and amount of
information that may be accessed through it, such legislation is critical to protect the fundamental
rights of privacy of an individual.
ii. Electronic and Digital Signature Law: This is required so that uniform and standard
procedures are established for authentication of electronics records, EDI, E-Mail.
iii. Computer Crime Law: due to victim of internet threats.
iv. Telecommunication Law: Approve and supervise the application of fees and rates charged
for telecommunication services in accordance with the provision of the applicable law.
v. Intellectual Property Law: This includes copyright law, trademark law, semiconductor
law and patent law in relation to computer hardware and software.
5. Web Applications:
Simple office software (word processors, online spreadsheets, and presentation tools).
More advanced applications such as project management, computer-aided design, video editing
and point-of-sale.
C. Identify your target users: The matter of a website will be determined by the users whom
you want to visit the site. This is totally depend upon
i. Market research
ii. Focus group
iii. Understanding intranet audiences
8. Identification of objects:
Object identification: All the components which are visible in website are objects or in other
words, we can say that all visible components in the web browser are defined as objects. Ex. Text
box, command button etc.
9. Web Team: Web team is a group of various technical experts in a developing site from coding
the page to maintain the web server.
Types:
A. Server Side: hired by a company to develop a website.
B. Client Side: part of the company putting together the website.
Assessment techniques used to comprise a web team:
a. Deciding roles and responsibilities: The composition of team varies to depend on the
audience, scope and complexity level of the web. There are key roles on each virtual project.
One should always decide for core, extended and special team members in a web and shares
responsibilities accordingly.
· Developing concept
· Content planning
· Rough design
· Final design
6. Launch:
· Connect domain name with web server
· Finally host the web accordingly.
·
· Internet Services
connection.
• Client/Server computing is NOT concerned directly with
communications over the network.
The client's res pons ibility is us ually ot :
HTML
Development Types
Technology Web
Server Name Sun Java(JSP,Servlet)
Apache
Tomcat Microsoft(ASP,ASP.NET) IIS
PHP WAMP
Web Development
• <html>
• <head>
• </head>
• <body bgcolor="pink">
• Hello Friends
• </body>
• </html>
Basic HTML Tags
• The HTML element is everything from the start tag to the end
tag:
<tagname>Content goes here...</tagname>
HTML Attributes
• You can add comments to your HTML source by using the following
syntax:
<!-- Write your comments here -->
Notice that there is an exclamation point (!) in the start tag, but not in the
end tag.
• Example
<p>This is a paragraph.</p>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
HTML Paragraphs
<p>This is a paragraph.</p>
Elements
Tag Description
• The HTML <blockquote> element defines a section that is quoted from another
source.
Example
Example
<p>WWF's goal is to: <q>Build a future where people live in
harmony with nature.</q></p>
HTML <abbr> for Abbreviations
• The HTML <address> tag defines the contact information for the
author/owner of a document or an article.
• The contact information can be an email address, URL, physical
address, phone number, social media handle, etc.
• The text in the <address> element usually renders in italic, and
browsers will always add a line break before and after
the <address> element.
Example
• <address>
Written by
John Doe.<br>
Visit us
at:<br>
Example.com<
br>
Box 564, Disneyland<br>
USA
</address>
HTML <cite> for Work Title
• The HTML <cite> tag defines the title of a creative work (e.g. a book, a
poem, a song, a movie, a painting, a sculpture, etc.).
Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in
1893.</p>
Override
Example
<bdo dir="rtl">This text will be written from right to left</bdo
Note: A link does not have to be text. A link can be an image or any other
HTML element!
• HTML Links - Syntax
The HTML <a> tag defines a hyperlink. It has the following syntax:
• The link text is the part that will be visible to the reader.
• Clicking on the link text, will send the reader to the
specified URL address.
• Example
• By default, the linked page will be displayed in the current browser window.
To change this, you must specify another target for the link.
• The target attribute specifies where to open the linked document.
• The target attribute can have one of the following values:
to an Email Address
• Use mailto: inside the href attribute to create a link that opens the user's email
program (to let them send a new email):
Example
HTML Images
Syntax
<img src="url" alt="alternatetext">
Example
• <img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">
HTML 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.
Example:-
Here is the HTML source code for the image map above:
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm ">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm">
</map>
<h1>United College</h1>
</marquee>
HTML Lists
Example
Item
Item
Item
Item
1. First item
2. Second item
3. Third item
4. Fourth item
Attribute-
type- specifies the list type
for numbering use (A,a,I,i etc)
for bullets use (sqaure,circle)
Tag Description
HTML Table
• Each table row is defined with a <tr> tag. Each table header is defined with
a <th> tag. Each table data/cell is defined with a <td> tag.
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
HTML Forms
• An HTML form is used to collect user input. The user input is most
often sent to a server for processing.
• <input type="week">
Block-level Elements (DIV)
• A block-level element always starts on a new line and takes up the full
width available (stretches out to the left and right as far as it can).
• The <div> element is a block-level element.
Example 1:-
<div>Hello World</div>
Here are the block-level elements in
HTML:
• <form>
• <address> • <h1>-<h6>
• <article> • <header>
• <aside> • <hr>
• <blockquote> • <li>
• <canvas> • <main>
• <dd> • <nav>
• <div> • <noscript>
• <dl> • <ol>
• <dt> • <p>
• <fieldset> • <pre>
• <figcaption> • <section>
• <figure> • <table>
• <footer> • <tfoot>
• <ul>
Inline Elements (SPAN)
• An inline element does not start on a new line and it only takes up as much
width as necessary.
• <a> • <label>
• <abbr> • <map>
• <acronym> • <object>
• <b> • <output>
• <bdo> • <q>
• <big> • <samp>
• <br> • <script>
• <button> • <select>
• <cite> • <small>
• <code> • <span>
• <dfn> • <strong>
• <em> • <sub>
• <i> • <sup>
• <img> • <textarea>
• <input> • <time>
• <kbd> • <tt>
Frame
• Frame- Frame is used for splitting the window into different individual
parts. and each part you can embed a new html page.
• Tags Meaning
<frameset> Creates a
frame
Attribute
s
1. rows - creates horizontal frame
2. cols- create vertical frame
<frame> creates individual window Attributes
HTML Video
Example
</video>
How it Works
• The controls attribute adds video controls, like play, pause, and volume.
• The <source> element allows you to specify alternative video files which
the browser may choose from. The browser will use the first recognized
format.
• The text between the <video> and </video> tags will only be displayed in
browsers that do not support
the <video> element.
HTML Audio
• The HTML <audio> element is used to play an audio file on a web page.
Example
<audio controls>
</audio>
• The controls attribute adds audio controls, like play, pause, and volume.
• The <source> element allows you to specify alternative audio files which the
browser may choose from. The browser will use the first recognized format.
• The text between the <audio> and </audio> tags will only be displayed in
browsers that do not support the <audio> element.
HTML Entities
• If you use the less than (<) or greater than (>) signs in your text, the
browser might mix them with tags.
&entity_name;OR
&#entity_number;
• To add such symbols to an HTML page, you can use the entity name or the
entity number (a decimal or a hexadecimal reference) for the symbol.
Example
Display the euro sign, €, with an entity name, a decimal, and a hexadecimal
value:
<p>I will display €</p>
<p>I will display €</p>
<p>I will display €</p>
UNIT-2
CSS
By:-Mr. Sachin Kumar
Sonker
What is CSS?
• CSS stands for Cascading Style Sheets
• CSS describes how HTML elements are
to be displayed on screen, paper, or in
other media
• CSS saves a lot of work. It can
control the layout of multiple web
pages all at once
• External stylesheets are stored in CSS files
Why Use CSS?
• CSS is used to define styles for your web pages,
including the design, layout and variations in
display for different devices and screen sizes.
CSS Example:-
• body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p{
font-family:
verdana; font-size:
20px;
}
CSS Syntax
CSS Syntax
• A CSS rule-set consists of a selector and a declaration
block:
• EXAMPLE EXPLAINED
Example
• External styles are defined within the <link> element, inside the
<head> section of an HTML page:
• <!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type=“text/css” href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
• An external style sheet can be written in any
text editor, and must be saved with a .css
extension.
• The external .css file should not contain
any HTML tags.
• Here is how the "mystyle.css" file looks:
• "mystyle.css"
• body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left:
20px;
}
Internal CSS
• An internal style sheet may be used if one single HTML page has a unique style.
• The internal style is defined inside the <style> element, inside the head section.
• Example
• Internal styles are defined within the <style> element, inside the <head>
section of an HTML page:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: maroon;
margin-left:
40px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Inline CSS
• An inline style may be used to apply a unique style for a
single element.
• To use inline styles, add the style attribute to the relevant element.
The style attribute can contain any CSS property.
• Example
• Inline styles are defined within the "style" attribute of the
relevant element:
• <!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>
CSS Selector
The CSS element Selector
p{
text-align: center;
color: red;
}
The CSS id Selector
• The id selector uses the id attribute of an
HTML element to select a specific element.
• The id of an element is unique within a page, so
the id selector is used to select one unique
element!
• To select an element with a specific id, write a
hash (#) character, followed by the id of the
element.
Example
The CSS rule below will be applied to the HTML
element with id="para1":
#para1 {
text-align: center;
color: red;
}
The CSS class Selector
• The class selector selects HTML elements
with a specific class attribute.
• To select elements with a specific class,
write a period (.) character, followed by the
class name.
Example
In this example all HTML elements with
class="center" will be red and center-aligned:
.center {
text-align: center;
color: red;
}
CSS Comments
CSS Comments
• body {
background-color: lightblue;
}
Example
body {
background-image:
url("gradient_bg.png"); background-
repeat: repeat-x;
}
CSS background-repeat:no-repeat
Example
• Demonstration of the different border widths:
p.one {
border-style:
solid; border-
width: 5px;
}
p.two {
border-style: solid;
border-width:
medium;
}
CSS Border Color
• The border-color property is used to set the color of the four borders.
• The color can be set by:
• name - specify a color name, like "red"
• HEX - specify a HEX value, like "#ff0000"
• RGB - specify a RGB value, like "rgb(255,0,0)"
• transparent
• Note: If border-color is not set, it inherits the color of the element.
• Example
• Demonstration of the different border colors:
• p.one {
border-style:
solid; border-
color: red;
}
p.two {
border-style: solid;
border-color:
green;
}
CSS Border - Individual Sides
Example
• Set different padding for all four sides of a <div> element:
• div {
padding-top: 50px;
padding-right: 30px;
padding-bottom:
50px; padding-left:
80px;
}
CSS Height & Width
CSS Setting height and width
The height and width properties may have the following values:
• auto - This is default. The browser calculates the height and width
• length - Defines the height/width in px, cm etc.
• % - Defines the height/width in percent of the containing block
• initial - Sets the height/width to its default value
• inherit - The height/width will be inherited from its parent value
Example
Set the height and width of a <div> element:
div {
height:
200px;
width: 50%;
background-color: powderblue;
}
All CSS Dimension Properties
Property Description
height Sets the height of an element
Text
Color
• The color property is used to set the color of the text. The color is specified by:
• a color name - like "red"
• a HEX value - like "#ff0000"
• an RGB value - like "rgb(255,0,0)"
• The default text color for a page is defined in the body selector.
Example
• body {
background-color:
lightgrey; color: blue;
}
h1 {
background-color:
black; color: white;
}
TextAlignment
Example
• h1 {
text-align: center;
}
h2 {
text-align: left;
}
TextDecoration
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
TextTransformation
p.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}
TextShadow
Example
• h1 {
text-shadow: 2px 2px;
}
Add a color (red) to the shadow:
• Text shadow effect!
Example
• h1 {
text-shadow: 2px 2px red;
}
• /* unvisited link */
a:link {
/* selected link */ a:active {
color: red;
color: blue;
}
}
/* visited link */ • When setting the style
a:visited { for several link states,
color: green; there are some order
} rules:
• a:hover MUST come after
/* mouse over link */ a:link and a:visited
a:hover { • a:active MUST come
color: hotpink; after a:hover
}
CSS List
HTML Lists and CSS List Properties
• Example
• ol {
background: #ff9999;
padding: 20px;
}
ul {
background:
#3399ff; padding:
20px;
}
ol li {
background:
#ffe5e5; color:
darkred; padding:
5px;
margin-left: 35px;
}
ul li {
background:
#cce5ff; color:
darkblue; margin:
5px;
}
CSS Table
CSS Tables
Table Borders
• To specify table borders in
CSS, use the border property.
• The example below specifies a solid border
for
<table>, <th>, and <td> elements:
table, th, td {
border: 1px
solid;
}
Full-WidthTable
• Horizontal Alignment
• The text-align property sets the horizontal
alignment (like left, right, or center) of the
content in <th> or
<td>.
• By default, the content of <th> elements are
center- aligned and the content of <td>
elements are left- aligned.
• To center-align the content of <td> elements as
well, use text-align: center:
– td {
text-align: center;
}
CSSTableStyle
• Table Padding
• To control the space between the border
and the content in a table, use
the padding property on <td> and <th>
elements:
– th, td {
padding:
15px; text-
align: left;
}
Horizontal Dividers
Value Description
In its simplest use, the float property can be used to wrap text
around images.
CSS Layout
CSS Navigation Bar
Navigation Bar
• Example • Example
<ul>
<li><a ul {
href="default.asp">Home list-style-type: none;
</a></li> margin: 0;
<li><a padding: 0;
href="news.asp">News Overflow:auto;
</a></li>
}
<li><a href="contact.asp">
Contact</a></li> li a {
<li><a float:left;
href="about.asp">About }
</a></li>
</ul>
CSS Transforms
CSS 2D Transforms
Function Description
translate(x,y) Defines a 2D translation, moving the element along the X- and the Y-
axis
– div {
width: 100px;
height: 100px;
background: red;
transition: width
2s;
}
– div:hover {
width:
300px;
}
Property Description
Transition
• The transition-timing-function property specifies
the speed curve of the transition effect.
• The transition-timing-function property can have
the following values:
– ease - specifies a transition effect with a slow start,
then fast, then end slowly (this is default)
– linear - specifies a transition effect with the same
speed from start to end
– ease-in - specifies a transition effect with a slow start
– ease-out - specifies a transition effect with a slow end
– ease-in-out - specifies a transition effect with a slow start
and end
TransitionExamples
• div {
transition-property:
width; transition-
duration: 2s;
transition-timing-function:
linear; transition-delay: 1s;
}
• or by using the shorthand property transition:
DelaytheTransitionEffect
• div
{ width: 100px;
height: 100px;
background:
red;
transition: width 2s, height 2s, transform
2s;
• }
div:hover {
width:
300px;
height:
300px;
transform: rotate(180deg);
}
CSS Flex
CSS Flexbox Layout Module
Property Description
flex-wrap Specifies whether the flex items should wrap or not, if there is
not enough room for them on one flex line
justify-content Horizontally aligns the flex items when the items do not use all
available space on the main-axis
The flex-direction Property
Property Description
align-self Specifies the alignment for a flex item (overrides the flex
container's align-items property)
flex-grow Specifies how much a flex item will grow relative to the
rest of the flex items inside the same container
flex-shrink Specifies how much a flex item will shrink relative to the
rest
of the flex items inside the same container
order Specifies the order of the flex items inside the same
container
The order Property
• The order property specifies the order of the
flex items.
• The first flex item in the code does not
have to appear as the first item in the
layout.
• The order value must be a number, default
value is 0.
– <div class="flex-container">
<div style="order: 3">1</div>
<div style="order: 2">2</div>
<div style="order: 4">3</div>
<div style="order: 1">4</div>
</div>
The flex-grow Property
<html>
<head> </head>
<body>
<script type="text/javascript“>
document.write("Hello World“)
</script> <p>This is web page body </p>
</body>
</html>
JavaScript in External File
<html> <head>
<script type="text/javascript" src="filename.js”>
</script>
</head>
<body> ....... </body>
</html>
JavaScript Variable
A JavaScript variable is simply a name of storage
location.
There are two types of variables in JavaScript : local
variable and global variable.
There are some rules while declaring a JavaScript
variable (also known as identifiers).
• Name must start with a letter (a to z or A to Z),
underscore( _ ), or dollar( $ ) sign.
• After first letter we can use digits (0 to 9), for
example value1.
• JavaScript variables are case sensitive
<html>
<body>
<script>
var x = 10;
var y = 20;
var z=x+y;
document.write(z);
</script>
</body>
</html>
JavaScript local variable
A JavaScript local variable is declared inside
block or function. It is accessible within the
function or block only.
For example:
<script>
function abc(){
var x=10;//local variable
}
</script>
JavaScript global variable
A JavaScript global variable is accessible from any function. A variable i.e.
declared outside the function or declared with window object is
known as global variable.
For example:
<script>
var data=200;//gloabal variable
function a(){
document.writeln(data);
}
function b(){
document.writeln(data);
}
a();//calling JavaScript function
b();
</script>
JavaScript Data Types
There are two types of data types in
JavaScript.
• Primitive data type
• Non-primitive (reference) data type
JavaScript is a dynamic type language,
means you don't need to specify type of
the variable.
You need to use var here to specify the data
type. For example:
var a=40;//holding number
var b="Rahul";//holding string
JavaScript Numbers
JavaScript has only one type of numbers. Numbers can
be written with, or without decimals:
var x1=34.00; //Written with decimals
var x2=34; //Written without decimals
Extra large or extra small numbers can be written with scientific
(exponential) notation.
var y=123e5; // 12300000
var z=123e-5; // 0.00123
JavaScript Booleans
Booleans can only have two values: true or false. Booleans are
often used in conditional testing. You will learn more about
conditional testing in a later chapter of this tutorial.
var x=true
var y=false
JavaScript Arrays
var cars=new Array();
cars[0]="Saab";
cars[1]="Volvo";
cars[2]="BMW";
or (condensed array):
var cars=new Array("Saab","Volvo","BMW");
JavaScript Objects
An object is delimited by curly braces. Inside the braces the
object's properties are defined as name and value pairs
(name : value). The properties are separated by commas:
var person={firstname:"John", lastname:"Doe", id:5566};
name=person.lastname;
name=person["lastname"];
Undefined and Null
• Undefined is the value of a variable with no value.
• Variables can be emptied by setting the value to null.
cars=null;
person=null;
Declaring Variable Types
When you declare a new variable, you can declare its type using
the "new" keyword:
JavaScript variables are all objects. When you declare a variable
you create a new object.
var carname=new String;
var x= new Number;
var y= new Boolean;
var cars= new Array;
var person= new Object;
Operators
• Addition (+)
• Subtraction (-)
• Multiplication (*)
• Division (/)
• Modulus (%)
• String concatenation operator is “+”
• Pre-increment operator and post-increment operators
(++)
• Pre-decrement and post-decrement operators (--)
• NOT ( ! )
• AND ( && )
• OR ( || )
• Non identity (!= )
JavaScript Arithmetic Operators
JavaScript Array
JavaScript array is an object that represents a
collection of similar type of elements.
• By array literal
• By creating instance of Array directly (using
new keyword)
1) JavaScript array literal
The syntax of creating array using array literal is
given below:
var arrayname=[value1,value2.....valueN];
As you can see, values are contained inside [ ] and
separated by , (comma).
<script>
var emp=["Sonoo","Vimal","Ratan"];
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br/>");
}
</script>
2) JavaScript Array directly (new keyword)
The syntax of creating array directly is given below:
var arrayname=new Array();
<script>
var i;
var emp = new Array();
emp[0] = "Arun";
emp[1] = "Varun";
emp[2] = "John";
for (i=0;i<emp.length;i++){
document.write(emp[i] + "<br>");
}
</script>
JavaScript String
The JavaScript string is an object that represents
a sequence of characters.
There are 2 ways to create string in JavaScript
• By string literal
• By string object (using new keyword)
1) By string literal
The string literal is created using double quotes.
syntax
var stringname="string value";
<script>
var str="This is string literal";
document.write(str);
</script>
2) By string object (using new keyword)
The syntax of creating string object using new
keyword is given below:
var stringname=new String("string literal");
<script>
var stringname=new String("hello javascript strin
g");
document.write(stringname);
</script>
JavaScript String Methods
• charAt(index)
• concat(str)
• indexOf(str)
• lastIndexOf(str)
• toLowerCase()
• toUpperCase()
• slice(beginIndex, endIndex)
• trim()
Example 1
<script>
var str="javascript";
document.write(str.charAt(2));
</script>
Example 2
<script>
var s1="javascript ";
var s2="concat example";
var s3=s1.concat(s2);
document.write(s3);
</script>
Example 3
<script>
var s1="javascript from javatpoint indexof";
var n=s1.indexOf("from");
document.write(n);
</script>
Example 4
<script>
var s1="javascript from javatpoint indexof";
var n=s1.lastIndexOf("java");
document.write(n);
</script>
Example 5
<script>
var s1="JavaScript toLowerCase Example";
var s2=s1.toLowerCase();
document.write(s2);
</script>
Example 6
<script>
var s1=" javascript trim ";
var s2=s1.trim();
document.write(s2);
</script>
JavaScript Date Object
The JavaScript date object can be used to
get year, month and day.
<html>
<body>
Current Date and Time: <span id="txt"></span>
<script>
var today=new Date();
document.getElementById('txt').innerHTML=today;
</script>
</body>
</html>
JavaScript Math Object
• The JavaScript math object provides several
constants and methods to perform mathematical
operation. Unlike date object, it doesn't have
constructors.
<!DOCTYPE html>
<html>
<body>
Round of 4.3 is: <span id="p6"></span><br>
Round of 4.7 is: <span id="p7"></span>
<script>
document.getElementById('p6').innerHTML=Math.round(4.3);
document.getElementById('p7').innerHTML=Math.round(4.7);
</script>
</body>
</html>
Math Object
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Document Object Model
• The document object represents the whole html
document.
• When html document is loaded in the browser, it
becomes a document object.
• It is the root element that represents the html
document.
• it has properties and methods. By the help of
document object, we can add dynamic content to
our web page.
window.document
Is same as
document
DOM
• According to W3C - "The W3C Document
Object Model (DOM) is a platform and
language-neutral interface that allows
programs and scripts to dynamically access
and update the content, structure, and style of
a document."
Properties of document object
Methods of document object
Example
<script type="text/javascript">
function printvalue(){
var name=document.form1.name.value;
alert("Welcome: "+name);
}
</script>
<form name="form1">
Enter Name:<input type="text" name="name"/>
<input type="button" onclick="printvalue()" value="print
name"/>
</form>
document.getElementById() method
The document.getElementById() method returns the
element of specified id.
<script type="text/javascript">
function getcube(){
var number=document.getElementById("number").value;
alert(number*number*number);
}
</script>
<form>
Enter No:<input type="text" id="number" name="number"/>
<br/>
<input type="button" value="cube" onclick="getcube()"/>
</form>
document.getElementsByName() method
<script type="text/javascript">
function totalelements()
{
var allgenders=document.getElementsByName("gender");
alert("Total Genders:"+allgenders.length);
}
</script>
<form>
Male:<input type="radio" name="gender" value="male">
Female:<input type="radio" name="gender" value="female">
</script>
<form name="myForm">
<input type="password" value="" name="userPass" onkeyup=
"validate()">
Strength:<span id="mylocation">no strength</span>
</form>
JavaScript Form Validation
JavaScript can be used to validate data in HTML forms before
sending off the content to a server.
Form data that typically are checked by a JavaScript could be:
has the user left required fields empty?
has the user entered a valid e-mail address?
has the user entered a valid date?
has the user entered text in a numeric field?
E-mail Validation
The function below checks if the content has the general
syntax of an email.
This means that the input data must contain an @ sign and at
least one dot (.). Also, the @ must not be the first character
of the email address, and the last dot must be present after
the @ sign, and minimum 2 characters before the end.
JavaScript form validation example
<script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;
if (name==null || name==""){
alert("Name can't be blank");
return false;
}else if(password.length<6){
alert("Password must be at least 6 characters long.");
return false;
}
}
</script>
JavaScript email validation
<script>
function validateemail()
{
var x=document.myform.email.value;
var atposition=x.indexOf("@");
var dotposition=x.lastIndexOf(".");
if (atposition<1 || dotposition<atposition+2 || dotposition+2>=x.length){
alert("Please enter a valid e-
mail address \n atpostion:"+atposition+"\n dotposition:"+dotposition);
return false;
}
} </script>
<body>
<form name="myform" method="post" action="#" onsubmit="return validat
eemail();">
Email: <input type="text" name="email"><br/>
<input type="submit" value="register">
</form>
Browser Object Model
The Browser Object Model (BOM) is used to
interact with the browser.
The default object of browser is window means
you can call all the functions of window by
specifying window or directly. For example:
window.alert("hello javatpoint");
is same as:
alert("hello javatpoint");
Browser Object Model
Window Object
• The window object represents a window in
browser. An object of window is created
automatically by the browser.
• Window is the object of browser, it is not the
object of javascript. The javascript objects are
string, array, date etc.
Window Object
JavaScript Popup Boxes
• In JavaScript we can create three kinds of popup boxes: Alert box,
Confirm box, and Prompt box.
Alert Box
An alert box is often used if you want to make sure information comes
through to the user.
When an alert box pops up, the user will have to click "OK" to proceed.
Syntax:
alert("sometext")
Confirm Box
A confirm box is often used if you want the user to verify or accept
something.
When a confirm box pops up, the user will have to click either "OK" or
"Cancel" to proceed.
If the user clicks "OK", the box returns true. If the user clicks "Cancel", the
box returns false.
Syntax:
confirm("sometext")
Prompt Box
A prompt box is often used if you want the user to input a value before
entering a page.
When a prompt box pops up, the user will have to click either "OK" or
"Cancel" to proceed after entering an input value.
If the user clicks "OK" the box returns the input value. If the user clicks
"Cancel" the box returns null.
Syntax:
prompt("sometext","defaultvalue“)
setTimeout
<script type="text/javascript">
function msg(){
setTimeout(
function(){
alert("Welcome to Javatpoint after 2 seconds")
},2000);
}
</script>
function functionname()
{
some code to be executed
}
JavaScript Functions
A function is a block of code that will be executed when
"someone" calls it.
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
alert("Hello World!");
}
</script>
</head>
<body>
<button onclick="myFunction()">Try it</button>
</body>
</html>
Functions With a Return Value
• Sometimes you want your function to return a value
back to where the call was made.
• This is possible by using the return statement.
• When using the return statement, the function will
stop executing, and return the specified value.
Calling a Function with Arguments
• When you call a function, you can pass along some
values to it, these values are called arguments or
parameters.
• These arguments can be used inside the function.
<button onclick="myFunction(‘Abhishek
',’Professor')">click here</button>
<script>
function myFunction(name,job)
{
alert("Welcome " + name + ", the " + job);
}
</script>
Functions With a Return Value
• Sometimes you want your function to return a value back to
where the call was made.
• This is possible by using the return statement.
• When using the return statement, the function will stop
executing, and return the specified value.
Syntax
function myFunction()
{
var x=5;
return x;
}
Examples
<html>
<head>
<script type="text/javascript">
function product(a,b)
{
return a*b
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(product(4,3))
</script>
<p>The script in the body section calls a function with two parameters
(4 and 3).</p>
<p>The function will return the product of these two parameters.</p>
</body>
</html>
JavaScript For...In Statement
The for...in statement is used to loop (iterate) through the
elements of an array or through the properties of an object.
The code in the body of the for ... in loop is executed once for
each element/property.
Syntax
for (variable in object)
{
code to be executed
}
Example
<html>
<body>
<script type="text/javascript">
var x var mycars = new Array()
mycars*0+ = "Saab“
mycars*1+ = "Volvo“
mycars[2] = "BMW"
for (x in mycars)
{
document.write(mycars[x] + "<br />")
}
</script>
</body>
</html>
JavaScript Event
• Events are normally used in combination with functions, and the
function will not be executed before the event occurs!
• By using JavaScript, we have the ability to create dynamic web
pages. Events are actions that can be detected by JavaScript.
• Every element on a web page has certain events which can trigger
JavaScript functions. For example, we can use the onClick event of
a button element to indicate that a function will run when a user
clicks on the button.
Examples of events:
A mouse click
A web page or an image loading
Selecting an input box in an HTML form
Submitting an HTML form
A keystroke
JavaScript Event
Each and every element of the form will have
some restricted events associated with it
ServerSocket class
The ServerSocket class can be used to create a
server socket. This object is used to establish
communication with the clients.
Socket
Method Description
Prepared By
Sachin Kumar Sonker
Assistant Professor,UCER Naini,Allahabad
Java Socket Programming
• Java Socket programming is used for
communication between the applications
running on different JRE.
• Java Socket programming can be connection-
oriented or connection-less.
• Socket and ServerSocket classes are used for
connection-oriented socket programming.
• DatagramSocket and DatagramPacket classes
are used for connection-less socket
programming.
The client in socket programming must
know two information:
• IP Address of Server, and
• Port number.
Socket class
A socket is simply an endpoint for
communications between the machines.
The Socket class can be used to create a socket.
ServerSocket class
The ServerSocket class can be used to create a
server socket. This object is used to establish
communication with the clients.
Socket
Method Description
Introduction
Step-1
All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a
built-in XMLHttpRequest object.
variable=new XMLHttpRequest();
Old versions of Internet Explorer (IE5 and IE6) uses an ActiveX Object:
variable=new ActiveXObject("Microsoft.XMLHTTP");
Example
Var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
Step-2
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
Method Description
Step-3
Server Response
Property Description
Example
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
Step-4
200: "OK"
status
404: Page not found
Example
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 &&xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
Enterprise Java Bean(EJB)
Node.js
Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
Node.js is an
1 open source
Node.js is free 2
server
environment
requests.
• Extensive module ecosystem: npm (Node Package Manager) provides access to thousands
of reusable packages.
Core Modules
Node.js includes several core modules for essential functionality. Some commonly used ones are:
•Number
Example Loose Type
// Variable store number data type
let a = 35;
console.log(typeof a);
Output
// Variable store string data type number
a = “United College";
string
console.log(typeof a);
boolean
// Variable store Boolean data type
a = true; undefined
console.log(typeof a);
// Variable store undefined (no value) data type
a = undefined;
console.log(typeof a);
Object and Function
Node.js objects are the same as let company = {
Step Step
1Create a Folder
Such as WT
2 file java
Create
script file such as
Index.js
index.js
Step 3 Step
D:\WT>
Go to Command 4 index.js
D:\WT>node
Prompt
User input in run time
REPL
The full form of REPL is “Read Eval Print Loop”. It is an interactive console (similar to the
windows command prompt) for node.js where we can write node.js commands and the system will
provide its corresponding output.
In this REPL terminal of Nodejs, you can perform various mathematical operations.
The repl terminal is also known as a node shell.
Nodejs REPL Environment:
The Repl terminal comes automatically with the node.js installation. So if you have installed
node.js then you can use this terminal.
The four parts of Repl are as follows:
1) Read: It takes the user input, parses it into javascript, and then stores it in memory.
2) Eval: It evaluates the parsed javascript.
3) Print: The result of the evaluation is shown as an output.
4) Loop: It again starts reading. To break out of this loop you have to press ctrl+c twice.
Starting REPL Terminal:
• Open a terminal or command prompt.
• Type Node
• Press enter
In this example:
• fs.readFile is asynchronous.
• The last parameter is a callback function that will
be called once the file read operation completes.
Node fs.mkdir() Method
• The fs.mkdir() method in Node.js is used to create a directory
asynchronously.
• Syntax
• fs.mkdir(path, mode, callback)
• Parameters: This method accepts three parameters as mentioned above
and described below:
• path: This parameter holds the path of the directory that has to be created.
• mode: This parameter holds the recursive boolean value. The mode option
is used to set the directory permission, by default it is 0777.
• callback: This parameter holds the callback function that contains an error.
The recursive option if set to true will not give an error message if the
directory to be created already exists.
Node.js fs.rmdir() Method
• The path.dirname() method is used to get the directory name of the given
path. It ignores the respective platform’s trailing directory separators.
• Syntax:
• path.dirname( path )
• Parameters: This function accepts one parameter as mentioned above and
described below:
• path: It is the file path that would be used to extract the directory name. It
throws a TypeError if this parameter is not a string value.
• Return Value: It returns a string with the directory of the path.
• Below programs illustrate the path.dirname() method in Node.js:
Node.js path.extname() Method
• Create server
Install Express:
Create an Application:
const express = require('express');
const app = express();
const port = 3000;
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});
3. Middleware Usage
4. Error Handling
You can use middleware for various purposes,
such as logging, authentication, or parsing Express has a built-in error handling
mechanism. You can define custom error-
request bodies. For example, to use the body-
handling middleware
parser middleware:
6. Best Practices
• Organize Your Code: Structure your app using separate files for routes, controllers, and
middleware to maintain readability.
• Use Environment Variables: Manage configuration settings using environment variables with
libraries like dotenv.
• Error Handling: Implement comprehensive error handling to improve user experience and
facilitate debugging.
Express express.static() Function
</html>
Restful API
REpresentational State Transfer (REST) is an architectural style that defines a set of
constraints to be used for creating web services. REST API is a way of accessing web services
in a simple and flexible way without having any processing.
REST technology is generally preferred to the more robust Simple Object Access Protocol
(SOAP) technology because REST uses less bandwidth, simple and flexible making it more
suitable for internet usage. It’s used to fetch or give some information from a web service.
All communication done via REST API uses only HTTP request.
Key Principles of REST
4.Use of Standard HTTP Methods:
1.Statelessness:
•GET: Retrieve resource(s).
•Each request from a client to the server must contain
•POST: Create a new resource.
all the information needed to understand and process
•PUT: Update an existing resource.
the request. The server does not store client context.
•DELETE: Remove a resource.
2.Client-Server Architecture:
5.Representations:
•The client and server are separate, allowing for
•Resources can have multiple
independent development and scaling. Clients
representations (e.g., JSON, XML).
interact with the API without knowing the server's
JSON is commonly used in RESTful
internal workings.
APIs for data interchange.
3.Resource Identification:
6.Stateless Communication:
•Resources (data entities) are identified by URIs
•Each request is independent, with no
(Uniform Resource Identifiers). For example, /users
session state stored on the server.
might represent a collection of user resources.
MongoDB is an open-source, cross-platform, and distributed document-
MongoDB name is derived from the word "Humongous" which means huge,
enormous. MongoDB database is built to store a huge amount of data and
also perform fast.
Collection Table
Field Column
Advantages of MongoDB
1. MongoDB stores data as JSON based document that does not enforce the schema. It allows us to
store hierarchical data in a document. This makes it easy to store and retrieve data in an efficient
manner.
2. It is easy to scale up or down as per the requirement since it is a document based database.
MongoDB also allows us to split data across multiple servers.
3. MongoDB provides rich features like indexing, aggregation, file store, etc.
4. MongoDB performs fast with huge data.
5. MongoDB provides drivers to store and fetch data from different applications developed in different
technologies such as C#, Java, Python, Node.js, etc.
6. MongoDB provides tools to manage MongoDB databases.
Collection
A collection in MongoDB is similar to a table in RDBMS. MongoDB collections do not enforce schemas.
Each MongoDB collection can have multiple documents. A document is equilant to row in a table in
RDBMS.
To create a collection, use the db.createCollection() command.
In the RDBMS database, a table can have multiple rows and columns. Similarly in MongoDB, a collection can have
multiple documents which are equivalent to the rows. Each document has multiple "fields" which are equivalent to
the columns. So in simple terms, each MongoDB document is a record and a collection is a table that can store
multiple documents.
MongoDB - Insert Single Document in a Collection using insertOne()
In MongoDB, a collection represents a table in RDBMS and a document is like a record in a table.
MongoDB provides the following methods to insert documents into a collection:
1.insertOne() - Inserts a single document into a collection.
2.insert() - Inserts one or more documents into a collection.
3.insertMany() - Insert multiple documents into a collection.
insertOne()
Use the db.<collection>.insertOne() method to insert a single document in a collection. db points to the
current database, <collection> is existing or a new collection name.
Syntax:
db.collection.insertOne(document, [writeConcern])
MongoDB Command
Command Syntax Example
Servlet technology is robust and scalable because of java language. Before Servlet,
CGI (Common Gateway Interface) scripting language was common as a server-side
programming language. However, there were many disadvantages to this technology.
We have discussed these disadvantages below.
There are many interfaces and classes in the Servlet API such as Servlet,
GenericServlet, HttpServlet, ServletRequest, ServletResponse, etc.
What is a Servlet?
Servlet can be described in many ways, depending on the context.
o Servlet is a class that extends the capabilities of the servers and responds to the
incoming requests. It can respond to any requests.
Disadvantages of CGI
There are many problems in CGI technology:
1. If the number of clients increases, it takes more time for sending the response.
2. For each request, it starts a process, and the web server is limited to start
processes.
There are many advantages of Servlet over CGI. The web container creates threads for
handling the multiple requests to the Servlet. Threads have many benefits over the
Processes such as they share a common memory area, lightweight, cost of
communication between the threads are low. The advantages of Servlet are as follows:
1. Better performance: because it creates a thread for each request, not process.
3. Robust: JVM manages Servlets, so we don't need to worry about the memory
leak, garbage collection, etc.
A servlet life cycle can be defined as the entire process from its creation till the
destruction. The following are the paths followed by a servlet.
The servlet is initialized by calling the init() method.
The servlet calls service() method to process a client's request.
The servlet is terminated by calling the destroy() method.
Finally, servlet is garbage collected by the garbage collector of the JVM.
Now let us discuss the life cycle methods in detail.
The init() Method
The init method is called only once. It is called only when the servlet is created, and not
called for any user requests afterwards. So, it is used for one-time initializations, just as
with the init method of applets.
The servlet is normally created when a user first invokes a URL corresponding to the
servlet, but you can also specify that the servlet be loaded when the server is first
started.
When a user invokes a servlet, a single instance of each servlet gets created, with
each user request resulting in a new thread that is handed off to doGet or doPost as
appropriate. The init() method simply creates or loads some data that will be used
throughout the life of the servlet.
The init method definition looks like this −
public void init() throws ServletException {
// Initialization code...
}
The service() Method
The service() method is the main method to perform the actual task. The servlet
container (i.e. web server) calls the service() method to handle requests coming from
the client( browsers) and to write the formatted response back to the client.
Each time the server receives a request for a servlet, the server spawns a new thread
and calls service. The service() method checks the HTTP request type (GET, POST,
PUT, DELETE, etc.) and calls doGet, doPost, doPut, doDelete, etc. methods as
appropriate.
Here is the signature of this method −
public void service(ServletRequest request, ServletResponse
response)
throws ServletException, IOException {
}
The service () method is called by the container and service method invokes doGet,
doPost, doPut, doDelete, etc. methods as appropriate. So you have nothing to do with
service() method but you override either doGet() or doPost() depending on what type of
request you receive from the client.
The doGet() and doPost() are most frequently used methods with in each service
request. Here is the signature of these two methods.
Architecture Diagram
The following figure depicts a typical servlet life-cycle scenario.
First the HTTP requests coming to the server are delegated to the servlet
container.
The servlet container loads the servlet before invoking the service() method.
Then the servlet container handles multiple requests by spawning multiple
threads, each thread executing the service() method of a single instance of the
servlet.
Servlets Tasks
Servlets perform the following major tasks −
Read the explicit data sent by the clients (browsers). This includes an HTML
form on a Web page or it could also come from an applet or a custom HTTP
client program.
Read the implicit HTTP request data sent by the clients (browsers). This includes
cookies, media types and compression schemes the browser understands, and
so forth.
Process the data and generate the results. This process may require talking to a
database, executing an RMI or CORBA call, invoking a Web service, or
computing the response directly.
Send the explicit data (i.e., the document) to the clients (browsers). This
document can be sent in a variety of formats, including text (HTML or XML),
binary (GIF images), Excel, etc.
Send the implicit HTTP response to the clients (browsers). This includes telling
the browsers or other clients what type of document is being returned (e.g.,
HTML), setting cookies and caching parameters, and other such tasks.
Web Terminology
Servlet Description
Terminology
Website: static vs It is a collection of related web pages that may contain text, images, audio
dynamic and video.
HTTP Requests It is the request send by the computer to a web server that contains all
sorts of potentially interesting information.
Get vs Post It gives the difference between GET and POST request.
Container It is used in java for dynamically generating the web pages on the server
side.
Server: Web vs It is used to manage the network resources and for running the program or
Application software that provides services.
Content Type It is HTTP header that provides the description about what are you sending
to the browser.
Website
Website is a collection of related web pages that may contain text, images, audio and
video. The first page of a website is called home page. Each website has specific internet
address (URL) that you need to enter in your browser to access a website.
Website is hosted on one or more servers and can be accessed by visiting its homepage
using a computer network. A website is managed by its owner that can be an individual,
company or an organization.
A website can be of two types:
o Static Website
o Dynamic Website
Static website
Static website is the basic type of website that is easy to create. You don't need the
knowledge of web programming and database design to create a static website. Its web
pages are coded in HTML.
The codes are fixed for each page so the information contained in the page does not
change and it looks like a printed page.
Dynamic website
Dynamic website is a collection of dynamic web pages whose content changes
dynamically. It accesses content from a database or Content Management System
(CMS). Therefore, when you alter or update the content of the database, the content of
the website is also altered or updated.
In server side scripting, the software runs on the server and processing is completed in
the server then plain pages are sent to the user.
Prebuilt content is same every time the page is Content is generated quickly and changes regularly.
loaded.
It uses the HTML code for developing a It uses the server side languages such as PHP,SERVLET,
website. JSP, and ASP.NET etc. for developing a website.
It sends exactly the same response for every It may generate different HTML for each of the request.
request.
The content is only changed when someone The page contains "server-side" code which allows the
publishes and updates the file (sends it to the server to generate the unique content when the page is
web server). loaded.
Flexibility is the main advantage of static Content Management System (CMS) is the main
website. advantage of dynamic website.
HTTP Requests
The request sent by the computer to a web server, contains all sorts of potentially
interesting information; it is known as HTTP requests.
The HTTP client sends the request to the server in the form of request message which
includes following information:
o The Request-line
o The analysis of source IP address, proxy and port
o The analysis of destination IP address, protocol, port and host
o The Requested URI (Uniform Resource Identifier)
o The Request method and Content
o The User-Agent header
o The Connection control header
o The Cache control header
The HTTP request method indicates the method to be performed on the resource
identified by the Requested URI (Uniform Resource Identifier). This method is case-
sensitive and should be used in uppercase.
HTTP Description
Request
POST Asks the server to accept the body info attached. It is like GET request with extra info
sent with the request.
HEAD Asks for only the header part of whatever a GET would return. Just like GET but with no
body.
TRACE Asks for the loopback of the request message, for testing or troubleshooting.
PUT Says to put the enclosed info (the body) at the requested URL.
OPTIONS Asks for a list of the HTTP methods to which the thing at the request URL can respond
1) In case of Get request, only limited amount of In case of post request, large amount of
data can be sent because data is sent in header. data can be sent because data is sent in body.
2) Get request is not secured because data is exposed in Post request is secured because data is not
URL bar. exposed in URL bar.
5) Get request is more efficient and used more than Post. Post request is less efficient and used less
than get.
Servlet Container
It provides the runtime environment for JavaEE (j2ee) applications. The client/user can
request only a static WebPages from the server. If the user wants to read the web pages
as per input then the servlet container is used in java.
The servlet container is the part of web server which can be run in a separate process.
We can classify the servlet container states in three types:
Servlet Container States
The servlet container is the part of web server which can be run in a separate process.
We can classify the servlet container states in three types:
o Standalone: It is typical Java-based servers in which the servlet container and the
web servers are the integral part of a single program. For example:- Tomcat
running by itself
o In-process: It is separated from the web server, because a different program runs
within the address space of the main server as a plug-in. For example:- Tomcat
running inside the JBoss.
o Out-of-process: The web server and servlet container are different programs
which are run in a different process. For performing the communications between
them, web server uses the plug-in provided by the servlet container.
The Servlet Container performs many operations that are given below:
1. Web Server
2. Application Server
Web Server
Web server contains only web or servlet container. It can be used for servlet, jsp, struts,
jsf etc. It can't be used for EJB.
It is a computer where the web content can be stored. In general web server can be
used to host the web sites but there also used some other web servers also such as FTP,
email, storage, gaming etc.
Important points
o If the requested web page at the client side is not found, then web server will sends the
HTTP response: Error 404 Not found.
o When the web server searching the requested page if requested page is found then it
will send to the client with an HTTP response.
o If the client requests some other resources then web server will contact to application
server and data is store for constructing the HTTP response.
Application Server
Application server contains Web and EJB containers. It can be used for servlet, jsp, struts,
jsf, ejb etc. It is a component based product that lies in the middle-tier of a server
centric architecture.
It provides the middleware services for state maintenance and security, along with
persistence and data access. It is a type of server designed to install, operate and host
associated services and applications for the IT services, end users and organizations.
The javax.servlet package contains many interfaces and classes that are used by the
servlet or web container. These are not specific to any protocol.
The javax.servlet.http package contains interfaces and classes that are responsible for
http requests only.
1. Servlet
2. ServletRequest
3. ServletResponse
4. RequestDispatcher
5. ServletConfig
6. ServletContext
7. SingleThreadModel
8. Filter
9. FilterConfig
10. FilterChain
11. ServletRequestListener
12. ServletRequestAttributeListener
13. ServletContextListener
14. ServletContextAttributeListener
1. GenericServlet
2. ServletInputStream
3. ServletOutputStream
4. ServletRequestWrapper
5. ServletResponseWrapper
6. ServletRequestEvent
7. ServletContextEvent
8. ServletRequestAttributeEvent
9. ServletContextAttributeEvent
10. ServletException
11. UnavailableException
1. HttpServletRequest
2. HttpServletResponse
3. HttpSession
4. HttpSessionListener
5. HttpSessionAttributeListener
6. HttpSessionBindingListener
7. HttpSessionActivationListener
8. HttpSessionContext (deprecated now)
1. HttpServlet
2. Cookie
3. HttpServletRequestWrapper
4. HttpServletResponseWrapper
5. HttpSessionEvent
6. HttpSessionBindingEvent
7. HttpUtils (deprecated now)
Servlet Interface
Servlet interface provides commonbehaviorto all the servlets.Servlet interface defines
methods that all servlets must implement.
Servlet interface needs to be implemented for creating any servlet (either directly or
indirectly). It provides 3 life cycle methods that are used to initialize the servlet, to
service the requests, and to destroy the servlet and 2 non-life cycle methods.
Method Description
public void init(ServletConfig config) initializes the servlet. It is the life cycle method of
servlet and invoked by the web container only once.
public void destroy() is invoked only once and indicates that servlet is being
destroyed.
There are given 6 steps to create a servlet example. These steps are required for all the
servers.
The mostly used approach is by extending HttpServlet because it provides http request
specific method such as doGet(), doPost(), doHead() etc.
Here, we are going to use apache tomcat server in this example. The steps are as
follows:
Compiling a Servlet
Let us create a file with name HelloWorld.java with the code shown above. Place this
file at C:\ServletDevel (in Windows) or at /usr/ServletDevel (in Unix). This path location
must be added to CLASSPATH before proceeding further.
Assuming your environment is setup properly, go in ServletDevel directory and
compile HelloWorld.java as follows −
$ javac HelloWorld.java
If the servlet depends on any other libraries, you have to include those JAR files on
your CLASSPATH as well. I have included only servlet-api.jar JAR file because I'm not
using any other library in Hello World program.
This command line uses the built-in javac compiler that comes with the Sun
Microsystems Java Software Development Kit (JDK). For this command to work
properly, you have to include the location of the Java SDK that you are using in the
PATH environment variable.
If everything goes fine, above compilation would produce HelloWorld.class file in the
same directory. Next section would explain how a compiled servlet would be deployed
in production.
Servlet Deployment
By default, a servlet application is located at the path <Tomcat-
installationdirectory>/webapps/ROOT and the class file would reside in <Tomcat-
installationdirectory>/webapps/ROOT/WEB-INF/classes.
If you have a fully qualified class name of com.myorg.MyServlet, then this servlet
class must be located in WEB-INF/classes/com/myorg/MyServlet.class.
For now, let us copy HelloWorld.class into <Tomcat-
installationdirectory>/webapps/ROOT/WEB-INF/classes and create following entries
in web.xml file located in <Tomcat-installation-directory>/webapps/ROOT/WEB-INF/
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
Above entries to be created inside <web-app>...</web-app> tags available in web.xml
file. There could be various entries in this table already available, but never mind.
You are almost done, now let us start tomcat server using <Tomcat-
installationdirectory>\bin\startup.bat (on Windows) or <Tomcat-
installationdirectory>/bin/startup.sh (on Linux/Solaris etc.) and finally
type http://localhost:8080/HelloWorld in the browser's address box. If everything
goes fine, you would get the following result
Java Server Pages
(JSP)
What is JSP
Generated servlets
You can examine the source code
produced by the JSP translation process.
JSP Directives
taglib
Specify custom tags
JSP Directive Examples
Import java packages
<%@ page import="java.util.*,java.sql.*" %>
Doing calculations
The value of pi is <%= Math.PI %> and the square root
of two is <%= Math.sqrt(2.0) %> and today's date is
<%= new java.util.Date() %>.
In this example, there are 3 scriptlets elements and one expression element
Declaring methods
<%!
private int toInt(String s)
{
return Integer.parseInt(s);
}
%>
Including Files
<html>
<head><title>JSP Test</title></head>
<body>
<h1>JSP Test</h1>
Time: <%= new java.util.Date() %>
</body>
</html>
Example:
<html>
<head><title>...</title></head>
<body>
<h1>...</h1>
<p><%= request.getParameter("greeting") %></p>
</body></html>
<html>
<head><title>JSP Processing ...</title></head>
<body>
<h1>JSP Processing form with GET</h1>
<form action=“processForm.jsp" method="GET">
First name: <input type="text" name="firstName"><br />
Last name: <input type="text" name="lastName">
<p><input type="submit" name="button"
value="SubmitName"></p>
</form>
</body>
</html>
Example: HTML Form Submission Using POST
<html>
<head><title>JSP Processing ...</title></head>
<body>
<h1>JSP Processing form with POST</h1>
<form action=“processForm.jsp" method="POST">
First name: <input type="text" name="firstName"><br />
Last name: <input type="text" name="lastName">
<p><input type="submit" name="button"
value="SubmitName"></p>
</form>
</body>
</html>
ProcessForm.jsp:
<html>
<head>
<title>JSP Form Results</title>
</head>
<body>
<h1>JSP Form Results</h1>
Hello <%= request.getParameter("firstName") %>
<%= request.getParameter("lastName") %>
</body>
</html>
Temperature Conversion Example
<%@ page import="java.text.DecimalFormat" %>
<html>
<head><title>Fahrenheit ... Conversion</title></head>
<body>
<h1>Fahrenheit to Celsius Conversion</h1>
<% String self = request.getRequestURI();
if (request.getParameter("convert") == null)
{
%>
<form action="<%= self %>" method="POST">
Fahrenheit temperature:
<input type="text" name="fahrenheit" />
<p><input type="submit" name="convert"
value="Convert to Celsius" /></p>
</form>
<%
}
else
{
double fahr = 0.0;
try
{
fahr = Double.parseDouble(
request.getParameter("fahrenheit"));
}
catch (NumberFormatException e)
{
// do nothing, accept default value
}
Temperature Conversion Example (Contd.)
Java Beans
Special classes that encapsulate some
data
They have a default constructor
get and set methods for data fields
(properties)
A bean can be constructed in JSP using
<jsp:useBean id = "..." class = "..." />
If the bean already exists this statement
does nothing
Setting properties
To set a property of a bean use
<jsp:setProperty name="..."
property="..." value="..."
/>
To set a property using the value of a
request parameter use
<jsp:setProperty name="..."
property="..." param="..."
/>
Getting properties
<jsp:getProperty name="..."
property="..." />
A Greeting Bean
package beans;
public class Greeting
{
private String greeting; // the property
public Greeting()
{ greeting = "Hello World"; }
Reference
COS 2206 JSP, Barry G. Adams, Department of Mathematics and
Computer Science, Laurentain University.
,QWURGXFWLRQ WR-63
-DYD6HUYHU3DJHV -63 LVDWHFKQRORJ\EDVHGRQWKH-DYDODQJXDJHDQGHQDEOHV
WKHGHYHORSPHQWRIG\QDPLFZHEVLWHV-63ZDVGHYHORSHGE\6XQ0LFURV\VWHPV
WRDOORZVHUYHUVLGHGHYHORSPHQW-63ILOHVDUH+70/ILOHVZLWKVSHFLDO7DJV
FRQWDLQLQJ-DYDVRXUFHFRGHWKDWSURYLGHWKHG\QDPLFFRQWHQW
7KHIROORZLQJVKRZVWKH7\SLFDO:HEVHUYHUGLIIHUHQWFOLHQWVFRQQHFWLQJYLDWKH
,QWHUQHWWRD:HEVHUYHU,QWKLVH[DPSOHWKH:HEVHUYHULVUXQQLQJRQ8QL[DQG
LVWKHYHU\SRSXODU$SDFKH:HEVHUYHU
7\SLFDO:HE :HE
&OLHQW
VHUYHU VHUYHU
0DF26
,17(51(7
/LQX[
8QL[
$SDFKH:HEVHUYHU
:LQGRZV
)LUVWVWDWLFZHESDJHVZHUHGLVSOD\HG7\SLFDOO\WKHVHZHUHS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