Web Tech Unit I
Web Tech Unit I
Web Tech Unit I
Mission
Subject:Web
Subject: WebTechnology
Technology
Syllabus
Unit-1
Introduction: Introduction and Web Development Strategies, History of Web and Internet, Protocols Governing Web, Writing Web Projects, Connecting to
Internet, Introduction to Internet services and tools, Introduction to client-server computing. Core Java: Introduction, Operator, Data type, Variable, Arrays,
Methods & Classes, Inheritance, Package and Interface, Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event handling,
Introduction to AWT, AWT controls, Layout managers
Unit-2
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type definition, XML: DTD, XML schemes, Object Models, presenting and
using XML, Using XML Processors: DOM and SAX, Dynamic HTML
Unit-3
Scripting: Java script: Introduction, documents, forms, statements, functions, objects; introduction to AJAX, Networking : Internet Addressing,
InetAddress, Factory Methods, Instance Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram.
Unit-4
Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans Properties, Types of beans, Stateful Session bean, Stateless
Session bean, Entity bean
Java Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating, Databases with JDBC, Prepared Statements,
Transaction Processing, Stored Procedures.
Unit-5
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle, Handling HTTP get Requests, Handling HTTP post
Requests, Redirecting Requests to Other Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page Example, Implicit Objects, Scripting, Standard Actions,
Directives, Custom Tag Libraries..
Subject:Web
Subject: WebTechnology
Technology
Web Development Strategies
Web development strategies refer to the approaches and plans that developers use to design, build, and
maintain websites or web applications. These strategies encompass various aspects of the development
process, including project planning, design, coding, testing, deployment, and ongoing maintenance.
These strategies may vary depending on the specific goals, scale, and nature of the web development project.
Adaptability and a focus on continuous improvement are crucial for successful web development.
ARPANET
Networking project by
Pentagon’s Advanced
Research Projects
Goal: Agency (ARPA) Goal:
To allow scientists at To function if
different locations to part of network
share information were disabled
Became
functional
September 1969
Subject:
p. 69
Web Technology
History of internet
• 1968 - DARPA (Defense Advanced Research Projects Agency) of United States contracts with BBN
(Bolt, Beranek & Newman) to create ARPAnet
• ARPANET (Advanced Research Project Agency Network): Basic purpose of ARPANET was to
provide communication among the various bodies of government.
• 1970 - Initially, there were only five nodes, formally called Hosts.
• UCLA
• Stanford
• UC Santa Barbara
• U of Utah, and
• BBN
• 1972, the ARPANET spread over the globe with 23 nodes located at different countries and thus
became known as Internet.
• By the time, with invention of new technologies such as TCP/IP protocols, DNS, WWW, browsers,
scripting languages etc., Internet provided a medium to publish and access
information over the web.
Slow-speed High-speed
technology connection
Subject:
p. 70
Web Technology Next
The World Wide Web
What is a Web browser?
Program that allows you to view Web pages
Opera Safari
An ISO standard that covers all aspects of network communications is the Open Systems
Interconnection (OSI) model. It was first introduced in the late 1970s.
25
Subject: Web Technology
Protocol Governing Web
Protocol is a set of rules that used to communicate application to each other. OR a protocol is a interface
required for communicating the different application.
Few protocols are discussed bellow:
a. HTTP
b. ICMP
c. TCP/IP
d. UDP
e. FTP
f. SMTP
HTTP:
❑ HTTP stands for HyperText Transfer Protocol.
❑ HTTP is the primary protocol used to distribute information on the web. It
is a protocol used to access the data on the World Wide Web (www).
❑ The HTTP protocol can be used to transfer the data in the form of plain text, hypertext, audio, video,
and so on.
❑ HTTP functions as a request response protocol in the client server computing model.
TCP
▪It is a transport layer protocol.
▪TCP stands for Transmission control protocol.
▪It is one of the main protocol in TCP/IP network where IP protocol deals with packet.
▪TCP enables two hosts to establish a connection and exchange streams of data.
▪ TCP guarantees delivery of data and also guarantee that packet will be delivered in the same order in
which they were sent.
▪TCP is connection oriented and reliable transport layer protocol.
FTP
• FTP stands for File transfer protocol.
• FTP is a standard internet protocol provided by TCP/IP used for transmitting the files from one host to
• another.
• It is also used for downloading the files to computer from other servers
Objective of FTP
• It provides the sharing of files.
• It is used to encourage the use of remote computers.
• It transfers the data more reliably and efficiently.
SMTP is a set of communication guidelines that allow software to transmit an electronic mail over the
internet is called Simple Mail Transfer Protocol.
It is a program used for sending messages to other computer users based on e-mail addresses
4 Internet Relay Chat (IRC) : Allows the people from all over the world to communicate in real time.
5 Mailing Lists : Used to organize group of internet users to share common information through e-mail.
6 Internet Telephony (VoIP) : Allows the internet users to talk across internet to any PC equipped to receive the call.
7 Instant Messaging : Offers real time chat between individuals and group of people. Eg. Yahoo messenger, MSN messenger.
2 Archie : It’s updated database of public FTP sites and their content. It helps to search a file by its name.
What is e-mail?
Short for electronic mail
The transmission of messages and files via a computer network
▪ Messages can consist of simple text or can contain attachments, such as documents,
graphics, or audio/video clips
▪ Internet access providers usually provide an e-mail program
▪ Some Web sites—such as Google Gmail, Windows Live Hotmail,
and Yahoo! Mail—provide free e-mail services
One of the original services on the Internet
Subject:
p. 94 Fig. 2-27
Web Technology
Other Internet Services
How does an e-mail message travel?
Step 1. Using
e-mail software,
you create and send
message
Step 2.
Your software
contacts software on
your service Step 4.
provider’s outgoing When recipient uses
mail server e-mail software to check for
e-mail messages, the message
transfers from incoming mail
server to recipient’s computer
Step 3.
Software on outgoing mail server determines best route
for data and sends message, which travels along
Internet routers to recipient’s incoming mail server
What is a chat?
Real-time typed conversation that takes
place on a computer
Chat room is location on server that
permits users to discuss topics of
interest
• In client server computing, a server is a central node that services many client nodes.
On the other hand, in a peer to peer system, the nodes collectively use their resources
and communicate with each other.
• In client server computing the server is the one that communicates with the other
nodes. In peer to peer to computing, all the nodes are equal and share data with each
other directly.
• Client Server computing is believed to be a subcategory of the peer to peer computing
Phases:
• There are three execution phases of a program. These are written, compile and run.
• Writing a program is done by a java programmer like you and me.
• The compilation is done by the JAVAC compiler which is a primary Java compiler included in the Java
development kit (JDK). It takes Java program as input and generates bytecode as output.
• In the Run phase of a program, JVM executes the bytecode generated by the compiler.
2. Bytecode in the Development process: As discussed, the Javac compiler of JDK compiles the
java source code into bytecode so that it can be executed by JVM. It is saved as .class file by
the compiler.
3. Java Development Kit (JDK): As the name suggests, it is a complete Java Development Kit
that includes everything including compiler, Java Runtime Environment (JRE), java
debuggers, java docs, etc. For the program to execute in java, we need to install JDK on
our computer in order to create, compile and run the java program.
4. Java Runtime Environment (JRE): JDK includes JRE. JRE installation on our computers allows
the java program to run, however, we cannot compile it. JRE includes a browser, JVM, applet
supports, and plugins. For running the java program, a computer needs JRE.
Operator in Java is a symbol that is used to perform operations. For example: +, -, *, / etc.
There are many types of operators in Java which are given below:
• Unary Operator - ++, --, ~,!
• Arithmetic Operator - >, +,-,%,/,*
• Shift Operator - <<,>>
• Relational Operator - <,>,<=,>=,==
• Bitwise Operator – bitwise OR(|): The bitwise | operator always checks both conditions whether the
first condition is true or false. Bitwise AND(&): The bitwise & operator always checks both conditions
whether the first condition is true or false.
• Logical Operator - &&(AND) operator doesn’t check the second condition if the first condition is false. It
checks the second condition only if the first one is true, ||(OR) operator doesn’t check the second if the
first condition is true. It checks the second condition only if the first one is false.
• Local Variable:
A variable declared inside the body of the method is called a local variable.
Syntax: method() {
datatype variableName; // Local Variable
}
Instance Variable:
• A variable declared inside the class but outside the body of the method, is called an instance
variable. It is not declared static.
• It is called an instance variable because its value is instance-specific and is not shared among
instances.
• Every instance has its own copy of the instance variable.
• Syntax: class {
datatype variablename; // instance variable
}
int result = _a + $b + C + c;
System.out.println("Result: " + result);
}
} //Output - 100
These comments are useful to create an HTML file called API (application programming Interface) document.
This file contains a description of all the features of the software.
Example: A dog is an object because it has states like color, name, breed, etc. as well as behaviors like wagging the tail,
barking, eating, etc.
In Java, the new keyword is used to create new objects.
}
• In general, program execution starts with a main() method, and line-by-line execution of the program
tokens places a linear/Sequential flow of Execution.
PSV main()
{
line1 // Linear Sequential flow of
execution 2
}
}
• In general, program execution starts with a main() method, and line-by-line execution of the program
tokens places a linear/Sequential flow of Execution.
PSV main()
{
line1 // Linear Sequential flow of
execution 2
}
• Types of Method
There are two types of methods in Java:
• Predefined Method
• User-defined Method
Examples of inheritance
• Here, Examples of inheritance are shown in the figure. Programmer is the subclass, and Employee is the
superclass.
• The relationship between the two classes is Programmer IS-A Employee. It means that Programmer is a
type of Employee.
1. class Animal{
2. void eat(){System.out.println("eating...");}
3. }
4. class Dog extends Animal{
5. void bark(){System.out.println("barking...");}
6. }
7. class TestInheritance{
8. public static void main(String args[]){
9. Dog d=new Dog();
10. d.bark();
11.d.eat();
12.}}
• Exception Hierarchy
Javaprovides some pre-defined
execution classes, using which
we can perform
exception-handling mechanisms
simply and easily.
1. Checked Exceptions are known exceptions during compilation time only. We provide the necessary
solution i.e., the java compiler tells the user that an exception may occur at a particular line in your
program, this is done during compilation time.
2. Unchecked exceptions are unknown exceptions, during compilation time these exceptions are not
shown by the java-compiler. i.e., the user or developer provides proper necessary solutions based on
exceptions that occurred during execution time.
The advantages of Exception Handling in Java are as follows:
Provision to Complete Program Execution.
Easy Identification of Program Code and Error-Handling Code
Propagation of Errors.
Meaningful Error Reporting.
Identifying Error Types
Output:
ArithmeticException caught!
rest of the code executes
In this code, we're trying to access an index that doesn't exist in the array.
The corresponding catch block catches this exception and handles it by
printing a custom error message.
{
//statements that handle the exception
}
// Main Class
class Multithread {
public static void main(String[] args)
{
int n = 8; // Number of threads
for (int i = 0; i < n; i++) {
Thread object
= new Thread(new MultithreadingDemo());
object.start();
}
}
Subject: Web Technology
}
Multithread in
The life cycle of a thread
Java(Cont.…)
During the lifecycle of a thread, there are many states it can
enter.
• They include:
1. Newborn state
2. Runnable state
3. Running state
4. Blocked state
5. Dead stat
class Demo_print {
public static void main(String[] args)
{
// using print()
// all are printed in the
// same line
System.out.print("GfG! ");
System.out.print("GfG! ");
System.out.print("GfG! ");
}
}
The appletviewer tool allows you to run applets without a web browser.
myapplet.html
<html>
<body>
<applet code="First.class" width="300" height="300">
</applet>
</body>
</html>
1) Local Applet
2) Remote Applet
Syntax:
addTypeListener()
• Example 1: For KeyEvent we use addKeyListener() to register.
• Example 2:that For ActionEvent we use addActionListener() to register.
public void setSize(int width,int height) Sets the size (width and height) of the component.
public void setLayout(LayoutManager m) Defines the layout manager for the component.
public void setVisible(boolean status) Changes the visibility of the component, by default
false.