Web Technologies - PowerPoint PPT Presentation

1 / 64
About This Presentation
Title:

Web Technologies

Description:

1. Web Technologies. 2. HTML. XHTML. CSS. XML. JavaScript. VBSCRIPT DOM. DHTML. AJAX. E4X. WMLScript ... SQL stands for Structured Query Language. SQL allows ... – PowerPoint PPT presentation

Number of Views:182
Avg rating:3.0/5.0
Slides: 65
Provided by: ians101
Category:

less

Transcript and Presenter's Notes

Title: Web Technologies


1
Web Technologies
2
Web Technologies
  • HTML
  • XHTML
  • CSS
  • XML
  • JavaScript
  • VBSCRIPT DOM
  • DHTML
  • AJAX
  • E4X
  • WMLScript
  • SQL
  • ASP
  • ADO
  • PHP
  • CGI
  • PERL
  • .NET
  • SMIL
  • SVG
  • FLASH
  • Java applets
  • Java servlets
  • Java Server page

3
What is SQL?
  • SQL stands for Structured Query Language
  • SQL allows you to access a database
  • SQL can execute queries against a database
  • SQL can retrieve data from a database
  • SQL can insert new records in a database
  • SQL can delete records from a database
  • SQL can update records in a database
  • SQL is easy to learn

4
SQL Data Manipulation Language (DML)
  • SQL (Structured Query Language) is a syntax for
    executing queries. But the SQL language also
    includes a syntax to update, insert, and delete
    records.
  • These query and update commands together form the
    Data Manipulation Language (DML) part of SQL
  • SELECT - extracts data from a database table
  • UPDATE - updates data in a database table
  • DELETE - deletes data from a database table
  • INSERT INTO - inserts new data into a database
    table

5
SQL Data Definition Language (DDL)
  • The Data Definition Language (DDL) part of SQL
    permits database tables to be created or deleted.
    We can also define indexes (keys), specify links
    between tables, and impose constraints between
    database tables.
  • The most important DDL statements in SQL are 
  • CREATE TABLE - creates a new database table
  • ALTER TABLE - alters (changes) a database table
  • DROP TABLE - deletes a database table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index

6
SQL on the WEB
  • Many web applications require database at the
    back side.
  • We can use SQL for database activities.
  • We use SQL together with other technologies.

7
SQL Example with ASP
  • lthtmlgt
  • ltheadgt
  • lttitlegtMy First ASP Pagelt/titlegt
  • lt/headgt
  • ltbody bgcolor"white" text"black"gt
  • lt
  • Dim adoCon
  • Dim rsGuestbook
  • Dim strSQL
  • 'Create an ADO connection object
  • Set adoCon Server.CreateObject("ADODB.Connection
    ")
  • 'Set an active connection to the Connection
    object using a DSN-less connection
  • adoCon.Open "ProviderMicrosoft.Jet.OLEDB.4.0
    Data Source" Server.MapPath("mydb.mdb")
  • 'Create an ADO recordset object
  • Set rsGuestbook Server.CreateObject("ADODB.Recor
    dset")

8
SQL Example with ASP
  • 'Loop through the recordset
  • Do While not rsGuestbook.EOF
  • 'Write the HTML to display the current record
    in the recordset
  • Response.Write ("ltbrgt")
  • Response.Write (rsGuestbook("Name"))
  • Response.Write ("ltbrgt")
  • Response.Write (rsGuestbook("link"))
  • Response.Write ("ltbrgt")
  • Response.Write("Murat Koyuncu")
  • 'Move to the next record in the recordset
  • rsGuestbook.MoveNext
  • Loop
  • 'Reset server objects
  • rsGuestbook.Close
  • Set rsGuestbook Nothing
  • Set adoCon Nothing

9
What is ASP?
  • ASP stands for Active Server Pages.
  • ASP is a program that runs inside IIS.
  • IIS stands for Internet Information Services.
  • IIS comes as a free component with Windows
    Servers.
  • PWS is a smaller - but fully functional - version
    of IIS (for Windows 95/98).

10
ASP Compatibility
  • ASP is a Microsoft Technology.
  • To run IIS you must have Windows NT 4.0 or later.
  • To run PWS you must have Windows 95 or later.

11
What is an ASP File?
  • An ASP file is just the same as an HTML file.
  • An ASP file can contain text, HTML, XML, and
    scripts.
  • Scripts in an ASP file are executed on the
    server.
  • An ASP file has the file extension ".asp.

12
How Does ASP Differ from HTML?
  • When a browser requests an HTML file, the server
    returns the file.
  • When a browser requests an ASP file, IIS passes
    the request to the ASP engine.
  • The ASP engine reads the ASP file, line by line,
    and executes the scripts in the file.
  • Finally, the ASP file is returned to the browser
    as plain HTML.

13
What can ASP do for you?
  • Dynamically edit, change or add any content of a
    Web page.
  • Respond to user queries or data submitted from
    HTML forms.
  • Access any data or databases and return the
    results to a browser.
  • Customize a Web page to make it more useful for
    individual users.
  • The advantages of using ASP instead of CGI and
    Perl, are those of simplicity and speed.
  • Provide security since your ASP code can not be
    viewed from the browser.
  • Clever ASP programming can minimize the network
    traffic.
  • Important Because the scripts are executed on
    the server, the browser that displays the ASP
    file does not need to support scripting at all!

14
ASP Example
  • lthtmlgt
  • ltbodygtlt response.write("Hello World!")gt
  • lt/bodygt
  • lt/htmlgt

15
ASP Example-Code
  • lthtmlgt
  • ltbodygtltresponse.write(FormatDateTime(date(),vb
    generaldate))response.write("ltbr
    /gt")response.write(FormatDateTime(date(),vblongda
    te))response.write("ltbr /gt")response.write(Forma
    tDateTime(date(),vbshortdate))response.write("ltbr
    /gt")response.write(FormatDateTime(now(),vblongti
    me))response.write("ltbr /gt")response.write(Forma
    tDateTime(now(),vbshorttime))gtltpgt Syntax
    for FormatDateTime FormatDateTime(date,namedfo
    rmat).lt/pgtlt/bodygtlt/htmlgt

16
ASP Example-Output
  • 12/10/2007
  • Monday, December 10, 2007
  • 12/10/2007
  • 91658 AM
  • 0916
  • Syntax for FormatDateTime FormatDateTime(date,nam
    edformat).

17
What is ADO?
  • ADO is a Microsoft technology.
  • ADO stands for ActiveX Data Objects.
  • ADO is a Microsoft Active-X component.
  • ADO is automatically installed with Microsoft
    IIS.
  • ADO is a programming interface to access data in
    a database.

18
Accessing a Database from an ASP Page
  • The common way to access a database from
  • inside an ASP page is to
  • Create an ADO connection to a database.
  • Open the database connection.
  • Create an ADO recordset.
  • Open the recordset.
  • Extract the data you need from the recordset.
  • Close the recordset.
  • Close the connection.

19
Create a Database Connection
  • lt
  • set connServer.CreateObject ("ADODB.Connection")
  • conn.Provider"Microsoft.Jet.OLEDB.4.0"
  • conn.Open "c/webdata/northwind.mdb"
  • gt

20
An ODBC Connection to an MS Access Database
  • Here is how to create a connection to a MS Access
  • Database 
  • Open the ODBC icon in your Control Panel.
  • Choose the System DSN tab.
  • Click on Add in the System DSN tab.
  • Select the Microsoft Access Driver. Click Finish.
  • In the next screen, click Select to locate the
    database.
  • Give the database a Data Source Name (DSN).
  • Click OK.

21
An ODBC Connection to an MS Access Database
  • lt set
  • connServer.CreateObject
  • ("ADODB.Connection")
  • conn.Open "northwind"
  • gt

Name defined in ODBC
22
Create an ADO Table Recordset
  • lt
  • Set connServer.CreateObject ("ADODB.Connection")
  • conn.Provider"Microsoft.Jet.OLEDB.4.0"
  • conn.Open "c/webdata/northwind.mdb
  • Set rsServer.CreateObject ("ADODB.recordset")
  • rs.Open "Customers", conn
  • gt

23
Create an ADO SQL Recordset
  • lt
  • Set connServer.CreateObject ("ADODB.Connection")
  • conn.Provider"Microsoft.Jet.OLEDB.4.0
  • conn.Open "c/webdata/northwind.mdb
  • set rsServer.CreateObject ("ADODB.recordset")
  • rs.Open "Select from Customers", conn
  • gt

24
Extract Data from the Recordset
  • lt
  • .....
  • for each x in rs.fields
  • response.write(x.name) response.write(" ")
    response.write(x.value)
  • next
  • ....
  • gt

25
ADO Example
  • lthtmlgt
  • ltbodygt
  • lt set connServer.CreateObject("ADODB.Connection
    ") conn.Provider"Microsoft.Jet.OLEDB.4.0"
  • conn.Open "c/webdata/northwind.mdb
  • set rs Server.CreateObject("ADODB.recordset")
  • rs.Open "SELECT FROM Customers", conn
  • do until rs.EOF
  • for each x in rs.Fields
  • Response.Write(x.name)
  • Response.Write(" ")
  • Response.Write(x.value "ltbr /gt")
  • next
  • Response.Write("ltbr /gt")
  • rs.MoveNext
  • loop
  • rs.close
  • conn.close gt
  • lt/bodygt

26
What is PHP?
  • PHP stands for PHP Hypertext Preprocessor.
  • PHP is a server-side scripting language, like
    ASP.
  • PHP scripts are executed on the server.
  • PHP supports many databases (MySQL, Informix,
    Oracle, Sybase,Solid,PostgreSQL,Generic ODBC,
    etc.)
  • PHP is an open source software (OSS).
  • PHP is free to download and use.

27
What is a PHP File?
  • PHP files may contain text, HTML tags and
    scripts.
  • PHP files are returned to the browser as plain
    HTML.
  • PHP files have a file extension of ".php",
    ".php3", or ".phtml"

28
Why PHP?
  • PHP runs on different platforms (Windows, Linux,
    Unix, etc.).
  • PHP is compatible with almost all servers used
    today (Apache, IIS, etc.).
  • PHP is FREE to download from the official PHP
    resource www.php.net .
  • PHP is easy to learn and runs efficiently on the
    server side.

29
A free web server platform
  • Install an Apache server on a Windows or Linux
    machine.
  • Install PHP on a Windows or Linux machine.
  • Install MySQL on a Windows or Linux machine.

30
What do PHP code look like?
  • PHP is a rather simple language.
  • Much of its syntax is borrowed from C except for
    dealing with the types of variables.
  • You don't need to think of the types of variables
    at all - you just work with their values, not
    their types.
  • And you don't have to declare variables before
    you use them.

31
A simple PHP example
  • lthtmlgt
  • ltbodygt
  • lt?php
  • echo "Hello World"
  • ?gt
  • lt/bodygt
  • lt/htmlgt

32
PHP Examples
  • lthtmlgt
  • ltbodygt
  • lt?php ddate("D")
  • if (d"Fri")
  • echo "Have a nice weekend!"
  • else
  • echo "Have a nice day!"
  • ?gt
  • lt/bodygt
  • lt/htmlgt

lthtmlgt ltbodygt lt?php for (i1 ilt5 i)
echo "Hello World!ltbr /gt" ?gt lt/bodygt
lt/htmlgt
33
PHP Database Example
  • lt?php
  • con mysql_connect("localhost","peter","abc123")
  • if (!con)
  • die('Could not connect ' . mysql_error())
  • mysql_select_db("my_db", con)
  • result mysql_query("SELECT FROM person")
  • while(row mysql_fetch_array(result))
  • echo row'FirstName' . " " .
    row'LastName'
  • echo "ltbr /gt"
  • mysql_close(con)
  • ?gt

34
PHP ODBC Connection
  • lthtmlgt
  • ltbodygt
  • lt?php
  • connodbc_connect('northwind','','')
  • if (!conn) exit("Connection Failed " .
    conn) sql"SELECT FROM customers"
    rsodbc_exec(conn,sql)
  • if (!rs) exit("Error in SQL")
  • echo "lttablegtlttrgt"
  • echo "ltthgtCompanynamelt/thgt"
  • echo "ltthgtContactnamelt/thgtlt/trgt"
  • while (odbc_fetch_row(rs))
  • compnameodbc_result(rs,"CompanyName")
  • connameodbc_result(rs,"ContactName")
  • echo "lttrgtlttdgtcompnamelt/tdgt"
  • echo "lttdgtconnamelt/tdgtlt/trgt"
  • odbc_close(conn)
  • echo "lt/tablegt" ?gt
  • lt/bodygt
  • lt/htmlgt

35
What is CGI?
  • The Common Gateway Interface (CGI) is a standard
    for interfacing external applications with
    information servers, such as HTTP or Web servers.
  • A plain HTML document that the Web daemon
    retrieves is static, which means it exists in a
    constant state a text file that doesn't change.
  • A CGI program, on the other hand, is executed in
    real-time, so that it can output dynamic
    information.

36
What is CGI?
  • For example, let's say that you wanted to "hook
    up" your Unix database to the World Wide Web, to
    allow people from all over the world to query it.
  • Basically, you need to create a CGI program that
    the Web daemon will execute to transmit
    information to the database engine, and receive
    the results back again and display them to the
    client.
  • This is an example of a gateway, and this is
    where CGI, currently version 1.1, got its
    origins.

37
What is CGI?
  • A CGI program can be written in any language that
    allows it to be executed on the system, such as
  • C/C
  • Fortran
  • PERL
  • TCL
  • Any Unix shell
  • Visual Basic
  • AppleScript

38
What is MS .NET
  • .NET is Microsoft's new Internet and Web
    strategy.
  • .NET is NOT a new operating system.
  • .NET is a new Internet and Web based
    infrastructure.
  • .NET delivers software as Web Services.
  • .NET is a framework for universal services.
  • .NET is a server centric computing model.
  • .NET will run in any browser on any platform.
  • .NET is based on the newest Web standards.

39
.NET Internet Standards
  • HTTP, the communication protocol between Internet
    Applications.
  • XML, the format for exchanging data between
    Internet Applications.
  • SOAP, the standard format for requesting Web
    Services.
  • UDDI, the standard to search and discover Web
    Services.

40
.NET Framework
  • The .NET Framework is the infrastructure for the
    new Microsoft .NET Platform. 
  • The .NET Framework contains common class
    libraries - like ADO.NET, ASP.NET and Windows
    Forms.
  • The .NET Framework is language neutral. Currently
    it supports C, C, Visual Basic, JScript (The
    Microsoft version of JavaScript) and COBOL.
  • The new Visual Studio.NET is a common development
    environment for the new .NET Framework.

41
.NET Framework
42
.NET Building Blocks
  • Web Services Web Services provide data and
    services to other applications (HTTP, HTML, XML,
    and SOAP).
  • Internet Directory Services .NET supports a new
    kind of directory services that can answer XML
    based questions about Internet Services, far more
    exactly than search engines and yellow pages.
    These services are built on the UDDI standard.
  • There are also some others

43
.NET Software
  • Windows.NET Windows 2000 and Windows XP
  • ASP.NET
  • Visual Studio.NET
  • Visual Basic.NET
  • SQL Server 2000
  • Internet Information Services 6.0

44
XML Based Web Protocols
  • SOAP SOAP (Simple Object Access Protocol) is a
    lightweight platform and language neutral
    communication protocol that allows programs to
    communicate via standard Internet HTTP. SOAP is
    standardized by the W3C.
  • WSDL WSDL (Web Services Description Language) is
    an XML-based language used to define web services
    and to describe how to access them. WSDL is a
    suggestion by Ariba, IBM and Microsoft for
    describing services for the W3C XML Activity on
    XML Protocols.
  • UDDI UDDI (Universal Description, Discovery and
    Integration) is a directory service where
    businesses can register and search for web
    services. UDDI is a public registry, where one
    can publish and inquire about web services.

45
Web service
46
  • What is Java applet?
  • What is Java servlet?
  • What is JavaServer Pages?
  • What is Java Web Start?

47
Java Applet
  • An applet is a software component that runs in
    the context of another program, for example a web
    browser.
  • A Java applet is an applet delivered in the form
    of Java bytecode. Java applets can run in a Web
    browser using a Java Virtual Machine (JVM), or in
    Sun's AppletViewer, a stand-alone tool for
    testing applets.


48
Java Applet
  • Java applets are usually written in the Java
    programming language but they can also be written
    in other languages that compile to Java bytecode.
  • Applets are used to provide interactive features
    to web applications that cannot be provided by
    HTML.
  • Since Java's bytecode is platform independent,
    Java applets can be executed by browsers for many
    platforms, including Windows, Unix, Mac OS and
    Linux.

49
Java bytecode
  • Java bytecode is the form of instructions that
    the Java virtual machine executes.
  • Each bytecode instruction is one byte in length.
  • Code
  • 0 iconst_2
  • 1 istore_1
  • 2 iload_1
  • 3 sipush 1000
  • 6 if_icmpge 44
  • 9 iconst_2
  • 10 istore_2
  • 11 iload_2
  • 12 iload_1
  • 41 goto 2
  • 44 return

50
What Is a Servlet?
  • Web server response can be static or dynamic
  • Static HTML document is retrieved from the file
    system and returned to the client
  • Dynamic HTML document is generated by a program
    in response to an HTTP request
  • Java servlets are one technology for producing
    dynamic server responses
  • Servlet is a class instantiated by the server to
    produce a dynamic response

51
Servlet Overview
52
Servlet Example
53
Servlet Example
54
Servlets vs. Java Applications
  • Servlets do not have a main()
  • The main() is in the server
  • Entry point to servlet code is via call to a
    method (doGet() in the example)
  • Servlet interaction with end user is indirect via
    request/response object APIs
  • Actual HTTP request/response processing is
    handled by the server
  • Primary servlet output is typically HTML

55
Running Servlets
  • Simple way to run a servlet
  • Compile servlet (make sure that JWSDP libraries
    are on path)
  • Copy .class file to shared/classes directory
  • (Re)start the Tomcat web server
  • If the class is named ServletHello, browse
    tohttp//localhost8080/servlet/ServletHello

56
What is JSP?
  • Short for Java Server Page.
  • A server-side technology.
  • Java Server Pages are an extension to the Java
    servlet technology that was developed by Sun.
  • JSPs have dynamic scripting capability that works
    in tandem with HTML code.

57
What is JSP?
  • The JSP syntax adds additional XML-like tags,
    called JSP actions, to be used to invoke built-in
    functionality.
  • A JSP compiler may generate a servlet in Java
    code that is then compiled by the Java compiler,
    or it may generate byte code for the servlet
    directly.
  • Compilation occurs the first time the application
    is run.
  • A JSP Compiler is triggered by the .jsp file name
    extension in a URL.

58
JSP Example
  • lt_at_ page errorPage"myerror.jsp" gt
  • lt_at_ page import"com.foo.bar" gt
  • lthtmlgt
  • ltheadgt
  • lt! int serverInstanceVariable 1gt
  • ...
  • lt int localStackBasedVariable 1 gt
  • lttablegt
  • lttrgt
  • lttdgtlt toStringOrBlank( "expanded inline data
    " 1 ) gtlt/tdgt
  • lt/trgt ...

59
JSP vs. Pure Servlets.
  • JSP doesn't give you anything that you couldn't
    in principle do with a servlet.
  • But it is more convenient to write (and to
    modify!).
  • By separating the look from the content you can
    put different people on different tasks your Web
    page design experts can build the HTML, leaving
    places for your servlet programmers to insert the
    dynamic content.

60
JSP vs ASP
  • It was originally created as an alternative to
    Microsoft's ASPs (Active Server Pages).
  • Recently, however, Microsoft has countered JSP
    technology with its own ASP.NET, part of the .NET
    initiative.

61
JSP vs. Active Server Pages (ASP).
  • ASP is a similar technology from Microsoft.
  • The advantages of JSP are twofold.
  • First, the dynamic part is written in Java, not
    Visual Basic or other MS-specific language, so it
    is more powerful and easier to use.
  • Second, it is portable to other operating systems
    and non-Microsoft Web servers.

62
JSP vs. JavaScript.
  • JavaScript can generate HTML dynamically on the
    client.
  • This is a useful capability, but only handles
    situations where the dynamic information is based
    on the client's environment.
  • Since it runs on the client, JavaScript can't
    access server-side resources like databases,
    catalogs, pricing information, and the like.

63
What is Java Web Start?
  • Suns tool for installing Java applications and
    updates.
  • It can also distribute Applets.
  • They automatically install and hook themselves up
    to the Java runtime.
  • All you have to do is click an icon with your
    browser to use them.
  • Java Web Start makes it easy for users to install
    Java apps once they have a web start enabled
    browser, or the web start app installed.

64
What is Java Web Start?
  • Java Web Start is a framework developed by Sun
    Microsystems which allows application software
    for the Java Platform to be started directly from
    the Internet using a web browser.
  • Unlike Java applets, Web Start applications do
    not run inside the browser.
  • One chief advantage of Web Start over applets is
    that they overcome many compatibility problems
    with browsers' Java plugins and different JVM
    versions.
  • On the other hand, Web Start programs cannot
    communicate with the browser as easily as
    applets.
Write a Comment
User Comments (0)
About PowerShow.com