The Internet - PowerPoint PPT Presentation

About This Presentation
Title:

The Internet

Description:

The Internet Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 12.2.2-12.2.4 HTML FORMS A method ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 7
Provided by: 66459
Category:
Tags: internet | java | script

less

Transcript and Presenter's Notes

Title: The Internet


1
The Internet
  • Programming Language Design and Implementation
    (4th Edition)
  • by T. Pratt and M. Zelkowitz
  • Prentice Hall, 2001
  • Section 12.2.2-12.2.4

2
HTML FORMS
  • A method for passing information between a user
    at a Web browser and a Web server.
  • This information is passed to a program on the
    server system. This is the Common Gateway
    Interface (CGI) file.
  • Web servers typically have a specific cgi-bin
    directory containing these CGI programs.
  • HTML forms are used
  • ltform methodtype
  • action location of cgi script to executegt
  • text
  • lt/formgt
  • Perl often used as language for such scripts

3
CGI script example
4
HTML for form
  • ltHTMLgt
  • ltHEADgt
  • ltTITLEgtcgi-testlt/TITLEgt
  • lt/HEADgt
  • ltBODYgt
  • ltpgt This is a sample page to read
  • two data items from the web page
  • ltform action"cgi-bin/xaction" methodgetgt
  • ltpgtFirst nameltinput typetext namexfirst
    size10gt
  • ltbrgtLast nameltinput typetext namexlast
    size20gt
  • ltbrgt ltinput typesubmit valueSENDgt
  • ltinput typereset valueRESETgt
  • lt/formgt
  • lt/BODYgt
  • lt/HTMLgt

Parameters passed as arguments xfirst and xlast
5
Perl - CGI script
  • !/usr/bin/perl
  • print Content-Type text/html\n\n
  • print lthtmlgtltheadgt\n
  • print lttitlegtSample PERL scriptlt/titlegt\n
  • print lt/headgtltbodygt\n
  • print ltpgtQuery_string is ENV'QUERY_STRING'\n
  • foreach ( split( //, ENV'QUERY_STRING') )
  • ( key, val ) split( //, _, 2 )
  • tmpkey val
  • print ltpgtFirst name is ltbgttmp'xfirst'lt/bgt\n
  • print ltpgtLast name is ltbgttmp'xlast'lt/bgt\n
  • print lt/bodygtlt/htmlgt\n
  • Perl program first reads parameters as
    xfirstzlast from ENV (environment) into
    QUERY_STRING
  • Output of Perl is the syntax of an HTML page that
    is displayed

6
Java applets
  • Issue Many different protocols
  • Solution Send program to read protocol as part
    of HTML
  • (Role for Java)
  • Moves processing needs from HTML server to HTML
    cllient
  • Do more processing on client side of web
  • import java.awt. / applet library /
  • public class hello extends java.applet.Applet
  • public void paint(Graphics x)
  • x.drawString(Hello World, 100, 100)
  • Displayed by
  • lthtmlgt
  • ltbodygt
  • ltapplet code hello.class width200
    height200gt
  • lt/appletgt
  • lt/bodygt
  • lt/htmlgt
Write a Comment
User Comments (0)
About PowerShow.com