unit1

66
1 Web-based Application Development Unit 1 CS 522 Instructor: Mata ur Rahman

Upload: zobi87

Post on 29-May-2015

141 views

Category:

Education


5 download

TRANSCRIPT

Page 1: Unit1

1

Web-based Application Development

Unit 1

CS 522

Instructor: Mata ur Rahman

Page 2: Unit1

2

Course Objectives• Understand the concepts of HTTP and WWW terminologies,

standards, protocols, standard organizations.• Understand the function and role of DNS, domain registration,

Hosting providers and services.• Understand the working of Web Browsers, Web Servers, Web

Documents and pages, Client site and Server site scripting etc.• Understand various markup languages like HTML, XML, XHTML

and various client site scripting language like JavaScript, XSLT and CSS

• Understanding of the role of different programming languages in the design and development of server-driven web environments.

• Understand various server site scripting languages like CGI, ASP/ASP.NET, JSP/Servlets/Java, PHP etc.

• Be able to understand database design and server-side scripting techniques for the development and deployment of database-driven web applications.

• Be able to develop a web-based application in Microsoft Visual Web developer (ASP.NET, C#), Netbeans (JSP, Servlets) and to deploy them on Internet Information Server and Tomcat.

Page 3: Unit1

3

What should a Web developer know?

• Basic Internet Technologies• HTTP protocol basics• The HTML 4.0.1 Standard• The CSS (Style Sheets)• The latest XHTML• XML & XSL• Client Side Scripting, Server Side Scripting• Database management and connectivity – SQL• How to run your own web servers?

Page 4: Unit1

4

Textbook and References• Internet & World Wide Web: How to Program

(2nd Edition)– Deitel, Deitel & Nieto, Prentice-Hall

• Core Web Programming (2nd edition)– Marty Hall, Larry Brown, Prentice-Hall

• ASP.NET developer Note Book By Wei-Meng Lee

• Java Server Pages 2nd Edition By Larne Pekowsky

Web Sites• http://www.w3schools.com• http://www.asp.net• http://java.sun.com

Page 5: Unit1

5

Course Materials

• LAN link of course resources– \\10.13.10.10\FacultyMaterial\Mata\WebBase

dApplicationDevelopment

Page 6: Unit1

6

Assessment Scheme• Quizes 5• Midterm: 20• Assignments: 12• Attendance 3

(Attendance Marks criteria >=95% 390%-95% 2.585%-90% 280%-85% 1.575%-80% 1<75% 0 (Prevention)

)• Final Exam + Sessional Projects 40+20

Page 7: Unit1

7

Course Structure• Week 1: Internet and Web Fundamental• Week 2: Web applications and HTML basics• Week 3: HTML and XHTML• Week 4: CSS and XML• Week 5,6: Java Scripts• Week 7: DHTML• Week 8: XSLT• Week 9,10,11: ASP, .NET and C#• Week 12,13: ADO.NET, DB connectivity• Week 14,15: JSP, Servlets, JDBC• Week 16: Presentation of Project

Page 8: Unit1

8

Programming Tools• Microsoft Front Page, Dream weaver

• Visual Web Developer• Netbean• Jdk1.6• Microsoft Access, ODBC

Web Servers• Internet Information Server• Apache• Tomcat

Page 9: Unit1

9

HTTP and WWW

The WWW today is a distributed client/server service, in which a client using a browser can access a service using a server.

However, the service provided is distributed over many locations called sites.

Page 10: Unit1

10

HTTP• Hypertext Transfer Protocol (HTTP) – main protocol

used to access data on the World Wide Web (WWW)• Uses the services of TCP to deliver requests and

responses• Request line defines the request type, resource

(URL), and HTTP version

Page 11: Unit1

11

What is the WWW?

• WWW stands for the World Wide Web • The World Wide Web is most often called the Web• The Web is a network of computers all over the wor

ld• All the computers in the Web can communicate with

each other• All the computers use a communication standard ca

lled HTTP• Hypermedia documents can contain pictures,

graphics and sound

Page 12: Unit1

12

Architecture of WWW

Page 13: Unit1

13

How Does the WWW Work?

• Web information is stored in documents called Web pages

• Web pages are files stored on computers called Web servers

• Computers reading the Web pages are called Web clients

• Web clients view the pages with a program called a Web browser

• Popular browsers are Internet Explorer, Mozilla Firefox, Opera, Netscape Navigator

Page 14: Unit1

14

How Does the Browser Fetch the Pages?

• A browser fetches a Web page from a server by a request

• A request is a standard HTTP request containing a page address

• A page address looks like: http://www.someone.com/page.htm

• Web Server return the page in HTTP response

Page 15: Unit1

15

Browser Architecture

• Consists of three parts

• A controller receives input from keyboard and mouse, uses client programs (HTTP, SMTP, FTP) to access the document; then uses an interpreter (HTML or Java) to display the document on the screen

• Documents are either static, dynamic, or active

Page 16: Unit1

16

Browser

Page 17: Unit1

17

How Does the Browser Display the Pages?• All Web pages contain instructions on how to be

displayed• The browser displays the page by reading these

instructions• The most common display instructions are called

HTML tags• The HTML tag for a paragraph looks like this: </p>• A paragraph in HTML is defined like this <p>This is

a Paragraph</p>

Page 18: Unit1

18

Beginning and ending tags

Page 19: Unit1

19

Static document

Page 20: Unit1

20

HTML• Hypertext Markup Language – language for creating

Web pages which has formatting instructions embedded in the file itself

• Web page consists of head (title) and body (contents)

Page 21: Unit1

21

Dynamic documents• Do not exist in predefined format; created

when browser requests the document

• Common Gateway Interface (CGI) – used to create and handle dynamic documents; set of standards that defines how a dynamic document should be written, how input data should be supplied to the program, and how the output result should be used

• Not a language; set of rules

Page 22: Unit1

22

Dynamic document using CGI

Page 23: Unit1

23

Dynamic document using server-site script

Page 24: Unit1

24

Active Documents

• Copy of a program retrieved by the client and run at the client site

• Often written in Java since it is platform independent

• To use an applet, an HTML document is created and the name is inserted between tags

Page 25: Unit1

25

Active document using Java applet

Page 26: Unit1

26

Active document using client-site script

Page 27: Unit1

27

HTTP

The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on the World Wide Web. HTTP functions as a combination of FTP and SMTP.

HTTP TransactionPersistent Versus Nonpersistent Connection

HTTP uses the services of TCP on well-known port 80

Page 28: Unit1

28

HTTP (cont)• Uniform Resource Locator (URL) – standard for

specifying method, host computer, port, and path– Method – protocol to retrieve document (FTP, HTTP)– Host – where information is located– May contain port number– Path defines where information is located– Version identifies HTTP version being used

(currently 1.1)

Page 29: Unit1

29

HTTP (cont)

• Response message consists of status line, header, and sometimes body

• Status line defines the status of the response message

• Headers exchange additional information between the client and server such as format information

Page 30: Unit1

30

HTTP transaction

Page 31: Unit1

31

Request and response messages

Page 32: Unit1

32

Request and status lines

Page 33: Unit1

33

Methods

Page 34: Unit1

34

Status codes

Page 35: Unit1

35

Status codes (continued)

Page 36: Unit1

36

Header format

Page 37: Unit1

37

General headers

Page 38: Unit1

38

Request headers

Page 39: Unit1

39

Response headers

Page 40: Unit1

40

Entity headers

Page 41: Unit1

41

HTTP (cont)• In nonpersistent connections, one TCP

connection is made for each request/response

• In persistent connections (default in v 1.1), the server leaves the connection open for more requests after sending a response– Connection may be closed after timer expires

or at request of client

• Proxy servers keep copies of responses to recent requests to decrease traffic and improve latency

Page 42: Unit1

42

This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in the GIF or JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Figure 27.16).

Example

Page 43: Unit1

43

Example 27.1

Page 44: Unit1

44

In this example, the client wants to send data to the server. We use the POST method. The request line shows the method (POST), URL, and HTTP version (1.1). There are four lines of headers. The request body contains the input information. The response message contains the status line and four lines of headers. The created document, which is a CGI document, is included as the body.

Example

Page 45: Unit1

45

Example

Page 46: Unit1

46

HTTP uses ASCII characters. A client can directly connect to a server using TELNET, which logs into port 80 (see next slide). The next three lines show that the connection is successful. We then type three lines. The first shows the request line (GET method), the second is the header (defining the host), the third is a blank, terminating the request. The server response is seven lines starting with the status line. The blank line at the end terminates the server response. The file of 14,230 lines is received after the blank line (not shown here). The last line is the output by the client.

Example

Page 47: Unit1

47

Example (continued)

Page 48: Unit1

48

Who is Making the Web Standards?

• The Web standards are not made up by Netscape or Microsoft

• The rule-making body of the Web is the W3C• W3C stands for the World Wide Web Consortium• W3C puts together specifications for Web

standards• The most essential Web standards are HTML, CSS

and XML• The latest HTML standard is XHTML 1.0

Page 49: Unit1

49

Domain Name• A domain name is a unique name for a web site,

like microsoft.com and w3schools.com.• Choosing a hosting solution should include

domain name registration.• Your domain name should be easy to remember

and easy to type.• Domain names must be registered. When

domain names are registered it is stored on a DNS server.

• DNS stands for Domain Name System. A DNS server is responsible for informing all other computers on the Internet about your domain name and your site address.

Page 50: Unit1

50

Domain Name System (DNS)

• In the past, mapping of IP addresses was static using a host file

• Impossible in today’s dynamic environment

• Domain Name System (DNS) was created to divide mapping information to be stored on multiple computers to be accessed when needed

Page 51: Unit1

51

Domain Name Space

• Structure for organizing the name space in which names are defined in an inverted-tree structure with the root at the top

• Each level of the tree defines a hierarchical level

Page 52: Unit1

52

Distribution of Name Space• Information for domain

name space must be stored on multiple servers (DNS servers) to be efficient

• Stored in a hierarchy of servers

• Zone defines the domain a server is responsible for

• Hierarchy of Name Servers • Zone • Root Server • Primary and Secondary

Servers

Page 53: Unit1

53

DNS in the Internet• Domain name space is divided into three

sections: generic, country and inverse• Generic domains define hosts by generic

behavior• Country domains are also used to identify

national designations

Page 54: Unit1

54

DNS used in the Internet

Page 55: Unit1

55

Generic domains

Page 56: Unit1

56

Example of using the DNS service

Page 57: Unit1

57

Domain Name Registrars• Registrar

How are new domains added to DNS? This is done through a registrar, a commercial entity accredited by ICANN. A registrar first verifies that the requested domain name is unique and then enters it into the DNS database. A fee is charged.

• Registrars of Generic domain are many, some registrars are InterNIC www.networksolutions.net and www.dotdnr.com

• For every country there is a registrar to register country level domains like of pk domain registrar is PKNIC www.pknic.net

• From registrar sites domain name availability can be checked and registered.

Page 58: Unit1

58

Registering a Domain• Domains can be registered from domain name

registration companies such as http://www.dotdnr.com.• These companies provide interfaces to search for

available domain names and they offer a variety of domain name extensions that can be registered at the same time.

• Domain Name Registration provides registration services for .com .net .org .biz .info .us .nu .ws .cc and .tv domains.

• Newer domain extensions such as .biz .info and .us have more choices available as many of the popular domains have yet to be taken. While .com and .net domains are well established and recognized, most popular domains with these extensions are already registered.

Page 59: Unit1

59

Choosing Domain Name• The best domains have the following

characteristics:– Short - The shorter your domain, the easier it is to

reach and remember for users.– Meaningful - Select a domain that relates to your site

in a way that people will understand.– Clear - Avoid selecting a name that is difficult to spell

or pronounce. – Exposure: In order to maximize your sites exposure,

consider including a relevant search term in your domain. Of course, this should only be considered if it still maintains a short, clear and meaningful domain.

Page 60: Unit1

60

Web Hosting• Common Questions

– How does the Web work? – How can I make my own Web Site?– What is a Web Host? – What is an Internet and Hosting Service Provider?

• Web Hosting– Web hosting means storing your web site on a public

server.– Web hosting normally includes email services.– Web hosting often includes domain name registration.– If you want other people to view your web site, you

must copy your site to a public server called Hosting Server.

– Included in a Web hosting solution you can expect to find domain name registration and standard email services.

Page 61: Unit1

61

Hosting Service Providors• If you want your web site to be visible to the world, you

have to store it on a web server.• Most small businesses and companies store their web

site on a server provided by a Hosting Service Provider.• Hosting Your Own Web

– Hardware Expenses - To run a "real" web site, you may need some powerful server hardware, a permanent (24 hours a day ) high speed connection.

– Software Expenses - extra cost for software licenses, server licenses often are much higher than client licenses and also some server software licenses might have limits on number of concurrent users.

– Labor Expenses - You have to install your own hardware and software. You also have to deal with bugs and viruses, and keep your server constantly running in an environment where "everything could happen".

Page 62: Unit1

62

Advantages using Hosting Service Providors

• Renting a server from an Hosting Service Provider is a common option. Here are some advantages:.

• Connection Speed– Most providers have very fast connections to the Internet, like full

T3 fiber-optic 45Mps connections equivalent to about 2000 traditional (28K) modems or 1000 high speed (56K) modems.

• Powerful Hardware– Service providers often have many powerful web servers that can

be shared by several companies. You can also expect them to have an effective load balancing, and necessary backup servers.

• Security and Stability– Internet Service Providers are specialists on web hosting. Expect

their servers to have more than 99% up time, the latest software patches, and the best virus protection.

Page 63: Unit1

63

Web Hosting Things to Consider

• 24-hour support– Make sure your Internet service provider offers 24-hours support.

• Daily Backup– Make sure your service provider runs a secure daily backup

routine, otherwise you may lose some valuable data.• Traffic Volume

– Study the provider's traffic volume restrictions. • Bandwidth or Content Restrictions

– If you plan to publish pictures or broadcast video or sound, make sure that you can.

• Email Capabilities– Make sure your provider fully supports the email capabilities you

need. • Front Page Extensions• Database Access

– Make sure your provider fully supports the database access you need if you plan to use databases from your site.

Page 64: Unit1

64

Web Hosting Server Technologies

• Windows Hosting – Suitable if you want support of ASP, .NET, Access and SQL Server

• Unix/Linux Hosting

• Support for ASP, JSP, Servlets, PHP, ColdFusion etc.

• Support for MS Access, SQL Server, MySQL, Oracle etc.

Page 65: Unit1

65

Web Hosting Types• Free Hosting

– Advantages• Low cost. It's free.• Good for family, hobby or personal sites. • Free email is often an option.

– Disadvantages• No domain names.• Few, limited, or no software options.• Limited security options.• Limited or no database support.• Limited technical support.

• Shared (Virtual) Hosting– Shared hosting is very common, and very cost effective.– Advantages

• Low cost. Cost is shared with others.• Good for small business and average traffic.• Multiple software options.• Good Support

– Disadvantages• Reduced security due to many sites on one server.• Restrictions on traffic volume.• Restricted database and software support.

Page 66: Unit1

66

Web Hosting Types (Cont ..)• Dedicated Hosting

– With dedicated hosting your web site is hosted on a dedicated server.

– Advantages• Good for large business, Good for high traffic, Multiple domain

names.• Powerful email solutions, Powerful database support• Strong (unlimited) software support

– Disadvantages• Expensive and requires higher skills

• Collocated Hosting– It is a solution that lets you place (locate) your own web server on

the premises (locations) of a service provider.– Advantages

• High bandwidth, High uptime, High Security• Unlimited Software options

– Disadvantages• Expensive and requires higher skills.• Harder to configure and debug.