Presentation is loading. Please wait.

Presentation is loading. Please wait.

PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 1 PZ15A - The Internet Programming Language Design and.

Similar presentations


Presentation on theme: "PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 1 PZ15A - The Internet Programming Language Design and."— Presentation transcript:

1 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 1 PZ15A - 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 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 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: <form method=“type” action= “location of cgi script to execute”> text Perl often used as language for such scripts

3 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 3 CGI script example

4 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 4 HTML for form cgi-test This is a sample page to read two data items from the web page: First name= Last name= Parameters passed as arguments xfirst and xlast

5 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 5 Perl - CGI script #!/usr/bin/perl print “Content-Type: text/html\n\n”; print “ \n”; print “ Sample PERL script \n”; print “ \n”; print “ Query_string is $ENV{'QUERY_STRING'}\n”; foreach ( split( /&/, $ENV{'QUERY_STRING'}) ) { ( $key, $val ) = split( /=/, $_, 2 ); $tmp{$key} = $val; } print “ First name is $tmp{'xfirst'} \n”; print “ Last name is $tmp{'xlast'} \n”; print “ \n” Perl program first reads parameters as xfirst&zlast from $ENV (environment) into QUERY_STRING Output of Perl is the syntax of an HTML page that is displayed

6 PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 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:


Download ppt "PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, 2000 1 PZ15A - The Internet Programming Language Design and."

Similar presentations


Ads by Google