Beyond HTML - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Beyond HTML

Description:

Server preprocesses combine page and sends only html to browser ... dhtml. Scripting language. VBScript: Easiest to use. Jscript: For Java and C diehards ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 33
Provided by: jomaeb
Category:
Tags: html | beyond | dhtml

less

Transcript and Presenter's Notes

Title: Beyond HTML


1
Beyond HTML
  • Server-side Processing
  • Representing Data in Pages

2
Overview
  • ASP
  • What is an active server page?
  • Servers
  • Languages
  • Examples
  • XML

3
ASP Overview
  • What is an active server page?
  • Servers
  • Languages
  • VBScript
  • JScript
  • Examples
  • Questions

4
Active Server Page
  • Combination of html and code that run on an ASP
    enabled web server
  • Server preprocesses combine page and sends only
    html to browser
  • Business rules are not exposed using server side
    processing
  • Other server-side preprocessing
  • Forms used with Common Gateway Interface (CGI)
  • Application Programming Interface allows web
    server to communicate with other server side
    programs

5
Web Servers
  • Internet Information Server (IIS)
  • Microsofts industrial strength web server
  • Bundled with NT Server and Windows 2000
    Server/Advanced Server
  • Competitors
  • Netscape Enterprise Server
  • Apache
  • Only IIS supports APS
  • Comparison

6
Personal Web Server (PWS)
  • Personal Web Server was not designed to support
    high volume Web sites,
  • http//www.microsoft.com/NTServer/web/exec/feature
    /PWS.asp
  • http//www.studiodeluxe.net/pws/index.htm
  • PWS does not include all the features found in
    IIS, such as Microsoft Site Server Express, Index
    Server, and Certificate Server

7
Languages
  • Hypertext mark-up language
  • html
  • dhtml
  • Scripting language
  • VBScript Easiest to use
  • Jscript For Java and C diehards

8
Creating an ASP Page
  • Design layout of page
  • Design algorithm for processing
  • Design interaction between html and script
  • Write source using html and scripting language
  • Deploy on ASP enabled web server
  • IIS or PWS
  • Test and debug

9
Page Organization
  • lt_at_ LANGUAGEVBScript gt
  • lthtmlgt
  • ltheadgt
  • lttitlegtlt!-- Text for title --gtlt/titlegt
  • lt/headgt
  • ltbodygt
  • lt!-- tags, text, and script --gt
  • lt/bodygt
  • lt/htmlgt

10
Common HTML Tags
  • Headings
  • lth1gtlt/h1gt
  • lth2gtlt/h2gt
  • lth3gtlt/h3gt
  • Breaking text
  • ltpgtlt/pgt
  • ltbrgt
  • lthrgt
  • Aligning text
  • ltcentergtlt/centergt
  • ltleftgtlt/leftgt
  • ltrightgtlt/rightgt
  • Character styles
  • ltbgtlt/bgt
  • ltigtlt/igt
  • ltcodegtlt/codegt
  • Lists
  • ltolgtltligtlt/ligtlt/olgt
  • ltulgtltligtlt/ligtlt/ulgt
  • Table
  • lttablegt
  • lttrgt
  • lttdgtlt/tdgtlttdgtlt/tdgt
  • lt/trgt
  • lt/tablegt

11
Scripting in VB
  • Script tags same for VBScript or Jscript
  • lt REM Code goes in here gt
  • Control structures are the same as VB
  • for
  • do while
  • ifs
  • Variable declarations
  • Variant is the only type
  • Use Dim statement

12
Examples
  • My first ASP page
  • Text
  • ASP
  • Using a form
  • Text
  • ASP
  • Using a database
  • Text
  • ASP

13
My First ASP Page
  • lt_at_ LANGUAGEVBScript gt
  • lt Option Explicit gt
  • lthtmlgt
  • ltheadgt
  • lttitlegtMy First ASP Pagelt/titlegt
  • lt/headgt
  • ltbody bgcolorivorygt
  • ltcentergtlth1gtMy First ASP Pagelt/h1gtlt/centergt
  • ltpgtThis is my first ASP page.lt/pgt
  • lt If Time gt 120000 AM And Time lt 120000
    PM Then gt
  • lth2gtGood Morning!lt/h2gt
  • lt ElseIf Time gt 120000 PM And Time lt
    60000 PM Then gt
  • lth2gtGood Afternoon!lt/h2gt
  • lt Else gt
  • lth2gtGood Evening!lt/h2gt
  • lt End If gt
  • ltpgtI am happy that you visited my site.lt/pgt
  • lt/bodygt
  • lt/htmlgt

14
ASP Form Page
  • lt_at_ LANGUAGEVBScript gt
  • lt Option Explicit gt
  • lthtmlgt
  • ltheadgt
  • lttitlegtASP Page with Formlt/titlegt
  • lt/headgt
  • ltbody bgcolorivorygt
  • ltcentergt
  • lth1gtMy ASP Page with a Formlt/h1gt
  • lt/centergt
  • ltpgtThis is my ASP page with a form.nbsp It will
    display X-Windows colors supported by your
    system.lt/pgt

15
ASP Page Form
  • ltform method"POST" name"MyForm"
    action"../CIS470/ASPForm.asp"gt
  • lttable align"Center"gt
  • lttr align"Center"gt
  • lttdgtltbgtForm Labelslt/bgtlt/tdgtlttdgtltbgtForm
    Controlslt/bgtlt/tdgt
  • lt/trgt
  • lttrgt
  • lttd align"Right"gtNamelt/tdgt
  • lttdgtltinput type"text" size"20"
    name"txtName"gtlt/tdgt
  • lt/trgt
  • lttrgt
  • lttd align"Right"gtX-Windows Colorlt/tdgt
  • lttdgtltinput type"text" size"20"
    name"txtColor"gtlt/tdgt
  • lt/trgt
  • lttrgt
  • lttdgtlt/tdgtlttd align"Center"gtltinput typesubmit
    value"Submit"gtlt/tdgt
  • lt/trgt
  • lt/tablegt
  • lt/formgt

16
ASP with Form Script
  • lthrgt
  • lt
  • Dim tName
  • Dim tColor
  • Dim tMsg
  • tName Request("txtName")
  • tColor Request("txtColor")
  • tMsg "lth1gtHi! " tName "lt/h1gtltpgtThis color
    is " tColor ".lt/pgt"
  • If Trim(tColor) "" Then
  • tMsg "Hi! " tName " Please enter a
    Windows-X color and " _
  • "then press the Submit button."
  • End If
  • If UCase(tColor) "BLACK" Then
  • tFontColor "White"
  • Else
  • tFontColor "Black"
  • End If
  • gt
  • lttable width"100" bgcolorlt tColor gtgt

17
Database and ASP
  • Database
  • Includes
  • Driver
  • Connect database to ASP process
  • Query processing
  • Display results

18
ASP Connect to Database
  • lt_at_ LANGUAGE"VBScript" gt
  • lt Option Explicit gt
  • ltHTMLgt
  • ltBODY bgcolorIvorygt
  • lt! - include file"adovbs.inc" - -gt
  • lt
  • Dim menuConn, OnMenu
  • Dim tProvider, tDataSrc
  • tProvider "Microsoft.Jet.OLEDB.4.0"
  • tDataSrc "//www.cba
    root/maris-j/CIS470/menu.mdb"
  • Set menuConn Server.CreateObject("ADODB.Connecti
    on")
  • menuConn.Provider tProvider
  • menuConn.Properties("Data Source") tDataSrc
  • 'Set menuConn.Properties("Password") ""
  • menuConn.Open
  • gt
  • lth1gtDatabase Informationlt/h1gt
  • ltpgtProvidernbsplt menuConn.Provider gt

19
Query Display Results
  • lth1gtThe Cafeteria Menult/h1gt
  • lt
  • Set OnMenu menuConn.Execute("SELECT FROM Menu
    ORDER BY Date")
  • do until OnMenu.EOF gt
  • ltfont size5gtltOnMenu("Date")gtlt/fontgtltbrgt
  • Main Course ltOnMenu("MainCourse")gtltbrgt
  • Fruit ltOnMenu("Fruit")gtltbrgt
  • Vegetables ltOnMenu("Vegetable")gtltbrgt
  • Dessert ltOnMenu("Dessert")gtltpgt
  • lt OnMenu.MoveNext
  • loop gt
  • lt/BODYgt
  • lt/htmlgt

20
ASP Questions
21
XML Reference
  • http//www.w3schools.com/xml/

22
What is XML?
  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML.
  • XML was designed to describe data.
  • XML tags are not predefined in XML. You must
    define your own tags.
  • XML uses a DTD (Document Type Definition) to
    describe the data.
  • XML with a DTD is designed to be
    self-descriptive.

23
XML verses HTML
  • XML was designed to describe data, and to focus
    on what data is.
  • Designed to carry data.
  • Not a replacement for HTML.
  • HTML was designed to display data, and to focus
    on how data looks.

24
XML HTML Different Goals
  • XML was designed to describe data and to focus on
    what data is.
  • HTML is about displaying information, XML is
    about describing information.

25
XML General Rules
  • Tags not pre-defined
  • Opening and closing tags required
  • Case-sensitive
  • Spaces preserved

26
XML Structure
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltrootgt
  • ltchildgt
  • ltsubchildgt.....lt/subchildgt
  • lt/childgt
  • lt/rootgt

27
XML Code
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltnotegt
  • lttogtTovelt/togt
  • ltfromgtJanilt/fromgt
  • ltheadinggtReminderlt/headinggt
  • ltbodygtDon't forget me this weekend!lt/bodygt
  • lt/notegt

28
XML First Line Syntax
  • XML declaration
  • Defines the XML version
  • Defines character encoding used in document
  • lt?xml version"1.0" encoding"UTF-8"?gt

29
Next Line Syntax
  • Describes root element
  • Examples
  • ltnotegtlt/notegt
  • lthtml xmlns"http//www.w3.org/1999/xhtml"
    xmllang"en" lang"en"gtlt/htmlgt

30
Tag Syntax
  • All tags must be closed lttaggtlt/taggt
  • XML tags are case-sensitive
  • Three different tags
  • lttaggtltTaggtltTAGgt
  • Proper nesting
  • Okay ltulgtltligtltpgtlt/pgtlt/ligtlt/ulgt
  • Incorrect ltulgtltligtlt/ligtltpgtlt/pgtlt/ulgt
  • Spaces perserved
  • lttaggt 2 spaces stay! lt/taggt

31
Attribute Syntax
  • Not fundamental to data
  • Information about data
  • Message encoding is not fundamental to message
  • Destination, source, and text are fundamental to
    message
  • Values in quotations

32
Summary
  • ASP provides server side processing that hide
    business rules
  • XML represents data using simple rules
  • HTML tells how to display page content
  • XHTML is HTML defined in XML
Write a Comment
User Comments (0)
About PowerShow.com