web technologies and publishing on the web applications
play

Web Technologies and Publishing On the Web Applications Writing - PowerPoint PPT Presentation

Web Technologies and Publishing On the Web Applications Writing HTML with a text editor allows to generate web pages. These pages are said static Winter 2001 in the sense that they do not change. CMPUT 499: Dynamic Pages What if we


  1. Web Technologies and Publishing On the Web Applications • Writing HTML with a text editor allows to generate web pages. These pages are said static Winter 2001 in the sense that they do not change. CMPUT 499: Dynamic Pages • What if we want to personalize pages for particular visitors or events? Dr. Osmar R. Zaïane • What if we want to have actions on the page? • What if the content of the page is from a database? University of Alberta • Etc.  Dr. Osmar R. Zaïane, 2001 1  Dr. Osmar R. Zaïane, 2001 2 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Course Content Objectives of Lecture 7 • Introduction • Databases & WWW Dynamic Pages Dynamic Pages • Internet and WWW • SGML / XML • Protocols • Managing servers • Introduce some technologies for dynamic • HTML and beyond • Search Engines insertion and modification of page content • Animation & WWW • Web Mining • Java Script • CORBA • Discuss the automatic generation of page • Dynamic Pages • Security Issues content • Perl • Selected Topics • See a concrete example of DHTML. • Java Applets • Projects  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 3 3 4 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

  2. Outline of Lecture 7 Dynamic pages • What are Dynamic Pages? • Dynamic pages are pages that change • Server-Side Includes (SSI) • Dynamic pages are not static by definition • Conditional SSI (XSSI) • The change can be the fact that the page is never the same when downloaded again • Generating Pages on the fly • The change can be that the content of the • Dynamic HTML page is different for different visitors • DHTML Example (sliding menu) • The change can be generated by interaction  Dr. Osmar R. Zaïane, 2001 5  Dr. Osmar R. Zaïane, 2001 6 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Static versus Dynamic Problems with cache Request URL URL Request • Browsers cache web pages to avoid fetching them again. • If a page is meant to be different each time it is HTML page Response Response HTML page visited we should not cache it. Request URL • Force the browser to flush the cache by Dynamic Dynamic expiring the page or requesting that the on the on the browser does not cache the page client server • Some type of pages are by default not cached Response HTML page  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 7 8 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

  3. Outline of Lecture 7 Server Side Includes • What are Dynamic Pages? • Server side Includes (SSI) are commands that are “included” in HTML documents • Server-Side Includes (SSI) and are executed on the “server side” • Conditional SSI (XSSI) • The server parses the HTML document • Generating Pages on the fly containing SSI and replaces the commands • Dynamic HTML by the result of their execution • DHTML Example (sliding menu) • A web server has to be configured to parse HTML documents and process SSI  Dr. Osmar R. Zaïane, 2001 9  Dr. Osmar R. Zaïane, 2001 10 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Enabling Server-Side Includes Syntax for SSI • Web server has to be instructed to parse • Server-Side Includes are embedded inside the HTML documents addType text/html .shtml addHandler sever-parsed .shtml HTML document as HTML comments • Parsing HTML documents adds an overhead <!-- server-side include --> • Only files that contain SSI need to be parsed • There are different recognized commands • Usually HTML files with SSI have .shtml as called SSI elements suffix <!--#element attribute=value attribute=value … --> • What if a HTML document with SSI is not • Values are usually enclosed between double parsed? quotes and there is often only one attribute  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 11 12 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

  4. Other SSI Elements Allowed SSI Elements • exec executes a given shell command or • config controls aspects of parsing cgi. The valid attributes are: – Valid attributes are: • cgi the server executes the cgi which is • errmsg a message that is sent back to the client given the QUERY_STRING variable if an error occurs during parsing • cmd the server executes the given string • sizefmt sets the format to be used when using /bin/sh displaying the size of files ( bytes/abbrev ) • fsize prints the size of specified file • timefmt sets the format to print dates subject to sizefmt in config • echo prints an include variable or environment variables • file file relative to the current directory • virtual file relative to the current document – There are many available variables  Dr. Osmar R. Zaïane, 2001 13  Dr. Osmar R. Zaïane, 2001 14 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Other SSI Elements (con’t) Other SSI Elements (con’t) • flastmod prints the last modification date of • printenv prints all existing environment specified file. Same attributes as fsize variables • include inserts the text of a specified • set sets values of variables document. (no absolute path and no ../) – For example: • file file relative to the current directory • <!--#set var=“foo” value=“bar” --> • virtual file relative to the current document • <!--#set var=“who” value=“${ REMOTE_HOST }_${ REQUEST_METHOD }” -->  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 15 16 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

  5. Include Variables Example for SSI • DATE_GMT • The current date in Greenwich Mean Time • DATE_LOCAL <!--#include file=“.. -->” <!--#include file=“..” -->” Home Products Services Contact-us • The current date in local time zone • DOCUMENT_NAME <!--#exec cmd=“..” -->” Welcome Mr. John Smith • The file name of the document requested • DOCUMENT_URI • The URL path of the document requested • LAST_MODIFICATION Today is Thursday February 8 th 2001 <!--#echo var=“..” -->” • The last modification date of the document requested  Dr. Osmar R. Zaïane, 2001 17  Dr. Osmar R. Zaïane, 2001 18 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Adding Code Logic to SSI Outline of Lecture 7 • Conditional SSI (XSSI) is a feature • What are Dynamic Pages? supported by Apache servers. IIS and Netscape servers may also support it. • Server-Side Includes (SSI) • Allows to execute different commands • Conditional SSI (XSSI) depending upon environment variables • Generating Pages on the fly • There are 4 flow-control statements • Dynamic HTML <!--#if expr=“expression” --> • DHTML Example (sliding menu) <!--#elif expr=“expression” --> <!--#else --> <!--#endif -->  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 19 20 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

  6. Examples of XSSI Test Conditions • Loading a different file depending on browser • The test condition could be only one of the following: � String (true if String not empty) <!--#if expr= “${HTTP_USER_AGENT} = /Mozilla/” --> � String1 = String2 <!--#include file=“netscapebar.html” --> String could be a regular � String1 != String2 <!--#elif expr=“${HTTP_USER_AGENT} = /MSIE/” --> expression with unix egrep � String1 < String2 <!--#include file=“iebar.html” --> syntax /string/ � String1 > String2 <!--#else --> � String1 <= String2 <!--#include file=“defaultbar.html” --> Conjunction and � String1 >= String2 disjunction are && and || <!--#endif -->  Dr. Osmar R. Zaïane, 2001 21  Dr. Osmar R. Zaïane, 2001 22 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta Dynamically Generated Pages Outline of Lecture 7 Request URL • What are Dynamic Pages? • Server-Side Includes (SSI) • Conditional SSI (XSSI) • Generating Pages on the fly Response HTML page • Dynamic HTML • DHTML Example (sliding menu) • Initially, the pages don’t exist on the server • Pages are created on the fly when requested  Dr. Osmar R. Zaïane, 2001  Dr. Osmar R. Zaïane, 2001 23 24 Web Technologies and Applications University of Alberta Web Technologies and Applications University of Alberta

Recommend


More recommend