instead of a space in URLs and look out for trailing blanks So within a web

Instead of a space in urls and look out for trailing

This preview shows page 25 - 30 out of 61 pages.

" instead of a space in URLs and look out for trailing blanks So within a web site... use a relative path when the two files are more likely to be moved together (eg. a page & an image in it) use an absolute path when the two files are more likely to be moved separately 25 When to use relative vs. absolute paths
Image of page 25
CS 200 Winter 2018 The Web An HTML form is a web page with “[interface] widgets ” for supplying data: text edit boxes check boxes radio buttons pop-up menus 26 Forms
Image of page 26
CS 200 Winter 2018 The Web Web Servers can’t know in advance: what data will be sent to them from forms what should be done with it So there’s a convention (the “Common Gateway Interface”): for identifying the particular application to which form data should be sent for processing Actually, the CGI scheme is more general than this: a web server can run any application and return its output When the submit button is pressed the data is sent to a web server the web server forwards the data to a “ cgi ” (a separate program) the cgi processes the data & returns a web page to the server the server passes that response on to the browser Plug-ins 27 Forms and CGIs Students Register Assignments File Maker Marks Root .html Implementation .html ï ï ï jcbServer (Server) ReportMarks.cgi Safari A Lab Macintosh mac6001 (Client) Apache — the web server app network connection University4 Sybase
Image of page 27
CS 200 Winter 2018 The Web <HTML> <HEAD> <TITLE>Request Your Marks in CS 200</TITLE> </HEAD> <BODY> <P>To retrieve your marks to date in CS 200, please enter your last name (case doesn't matter) and student ID in the boxes shown below.</P> <P>Then click on the <STRONG>Fetch Marks</STRONG> button - ordinarily it shouldn't take more than thirty seconds or so for your marks to come back. (Please be patient - I'm only a Mac IIfx!)</P> <P>If you find a discrepancy, please notify the course tutor as soon as possible.</P> <FORM ACTION ="http: ../ReportMarks.cgi " METHOD =" GET "> <P> <STRONG>Your Last Name: </STRONG> <INPUT TYPE="text" NAME=" surname " SIZE="33"> </P> <P> <STRONG>Your ID Number: </STRONG> <INPUT TYPE="text" NAME=" idnumber " SIZE="33"> </P> <P> <INPUT TYPE="submit" VALUE="Fetch Marks"> </P> <P> <INPUT TYPE="hidden" NAME=" course " VALUE="cs200"> </P> </FORM> </BODY> </HTML> 28 The CS 200 Request Marks Form (simplified) Note the use of a “hidden parameter” that the user never sees so that forms for different courses can use the same cgi. T
Image of page 28
CS 200 Winter 2018 The Web What comes back ../ReportMarks.cgi locates the program (a “cgi”) to which the server forwards the form’s data Notice that the URL from which a web page came always appears in the location bar that the forms data is encoded in the URL how that URL appears in what’s sent to the server why the path to the cgi had better not contain a question mark! 29 What Gets Sent to the Server (GET) GET ../ReportMarks.cgi? course =cs200& surname =Daly& idnumber =00000000 HTTP/1.0 Connection: Keep-Alive User-Agent: Mozilla/4.06 (Macintosh; U; PPC, Nav) Host: jcbServer.cs.uwaterloo.ca Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */* Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 The rules for this stuff are part of the “http protocol.” T
Image of page 29
Image of page 30

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture