1 / 58

Chapter 9: Web Programming and Related Tools

Chapter 9: Web Programming and Related Tools. i-Net+ Guide to the Internet Third Edition. Objectives. Investigate tools that you can use in developing dynamic Web pages Sample several programming languages used to build Web sites Write simple Web page scripts

keena
Download Presentation

Chapter 9: Web Programming and Related Tools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 9: Web Programming and Related Tools i-Net+ Guide to the Internet Third Edition

  2. Objectives • Investigate tools that you can use in developing dynamic Web pages • Sample several programming languages used to build Web sites • Write simple Web page scripts • Learn how cookies are used on Web pages iNet+ Guide to the Internet, Third Edition

  3. Cascading Style Sheets • Cascading style sheets (CSS), developed by the World Wide Web Consortium (W3C), is a feature of HTML that makes it possible to apply consistent formatting to the HTML documents in a Web site. • CSS helps Web developers separate the design of a Web site from the content included in the Web site. • CSS works by controlling how the information on a Web page or entire Web site is displayed. iNet+ Guide to the Internet, Third Edition

  4. Cascading Style Sheets (Continued) • An external style sheet is a text file that contains rules for controlling how the browser displays a Web page that refers to the style sheet. iNet+ Guide to the Internet, Third Edition

  5. XML (Extensible Markup Language) and XSL (Extensible Style Language) • HTML is a subset of the Standard Generalized Markup Language (SGML), which is a standard for several markup languages. • A markup language has special codes that are inserted in a text file to instruct software how to display or print the text. • A newer markup language standard, called XML (Extensible Markup Language), is gaining popularity. iNet+ Guide to the Internet, Third Edition

  6. XML (Extensible Markup Language) and XSL (Extensible Style Language) (Continued) • XML supports the standards of SGML, while adding flexibility and power. • XML is not concerned about how a Web page looks. • Instead, XML is used to define and manage data. • Many applications of XML are emerging, one of which is XSL (Extensible Style Language). • XSL is a style language similar to CSS. iNet+ Guide to the Internet, Third Edition

  7. XML (Extensible Markup Language) and XSL (Extensible Style Language) (Continued) • An XSL file can contain styles, HTML, and pointers to XML files, which contain the data and tags. • XML uses a file called a document type definitions (DTD) file. • The DTD file provides a list of the tags, attributes, and all entities that can be contained in an XML document as well as their relationships to each other, and might even include how they can be arranged together on the page. iNet+ Guide to the Internet, Third Edition

  8. XHTML (Extensible Hypertext Markup Language) • Another application that uses XML is XHTML (Extensible Hypertext Markup Language), which integrates many of the features of XML into HTML. • Although XHTML tags are nearly identical to those in simple HTM, XHTML is stricter. • Developers must be certain their pages follow all the syntax rules of XHTML. iNet+ Guide to the Internet, Third Edition

  9. XHTML (Extensible Hypertext Markup Language) (Continued) • Pages that do follow the XHTML syntax rules are said to be well-formed. • XHTML is case sensitive, which means that all tags must be lowercase. • In XHTML, attributes must always be enclosed in quotation marks. iNet+ Guide to the Internet, Third Edition

  10. Introduction to Programming • A program is a list of instructions that are executed by an operating system or other software. • Sometimes, the program is written into a text file called a source file and is then assembled into a coded binary format called object code. • Next, the object code is combined with utilities that it needs and is then converted and stored into an executable file, so named because it is executed by the operating system. iNet+ Guide to the Internet, Third Edition

  11. Introduction to Programming (Continued) • Compiling is the process of translating the programming code, which a human can understand, into binary code, which the computer can understand. iNet+ Guide to the Internet, Third Edition

  12. Introduction to Programming (Continued) • Scripts and macros are two types of programs that generally do not need to be compiled. • These types of programs are sometimes very short, containing a list of instructions for performing a task, making decisions based on input, and producing output. • Web pages that can change their content are called dynamic Web pages or dynamic HTML (DHTML). • Web pages that do not change their content are called static Web pages. iNet+ Guide to the Internet, Third Edition

  13. Two Kinds of Programs • A program executed on the server is called a server-side script or server-side program. • A script executed on the client computer is called a client-side script or client-side program. iNet+ Guide to the Internet, Third Edition

  14. Basic Programming Concepts • A programming protocol is a set of rules or standards by which programs interact with the outside world. • A programming language, on the other hand, is a set of words or codes that are used to write a program. • A command is an order to perform an action, such as to get a file. • An argument customizes the action that is stated in the command. iNet+ Guide to the Internet, Third Edition

  15. Basic Programming Concepts (Continued) • Commands and their arguments are similar to tags and their attributes in HTML. iNet+ Guide to the Internet, Third Edition

  16. Objects • An object is a small program that performs a specific task. • It is like a middleman who manages the interface between the program and some other entity. • Objects can be written in several different programming languages and can run on a variety of operating systems. iNet+ Guide to the Internet, Third Edition

  17. Objects (Continued) • The CORBA (Common Object Request Broker Architecture) standard allows objects to communicate with each other regardless of the language in which they were written or the operating system on which they run. • To use CORBA, both client and server must be running an ORB (Object Request Broker). iNet+ Guide to the Internet, Third Edition

  18. Objects (Continued) • A dynamic link library (DLL) is a library of objects used by other programs to perform a specific task or group of related tasks. • DLLs enable many applications to share the same objects easily. • DLLs ease the process of upgrading or adding bug fixes to an operating system. iNet+ Guide to the Internet, Third Edition

  19. Functions • A function is a segment of programming code that can be executed out of order from the main list of commands on an as-needed basis. • Both objects and functions perform a task off to the side of the main flow of the program. • The difference between an object and a function is that an object is external to the program and can even be written in a different programming language, but a function is programming code included in the program. iNet+ Guide to the Internet, Third Edition

  20. Functions (Continued) iNet+ Guide to the Internet, Third Edition

  21. Survey of Programming Languages Used on the Internet • Languages have evolved over the past several decades based on changing needs and competition among manufacturers. • Because programming on the Internet has become popular, much attention has been given to improving programming languages. • As a result, some languages have already been through several versions, with each version gaining increased Internet functionality. • Table 9-1 on page 559 lists the programming protocols and languages used on the Web. iNet+ Guide to the Internet, Third Edition

  22. Programming Protocols • Keep in mind that a language can use more than one protocol and a protocol can be used by several languages. • Analogies include: addressing an envelope and writing a business letter. • You use one protocol for addressing envelopes and another protocol for writing a business letter. • Each can be done in several languages (English, Spanish, and so forth). iNet+ Guide to the Internet, Third Edition

  23. CGI (Common Gateway Interface) • The first, and still a very popular, protocol for a program or script for interacting with a Web server is CGI (Common Gateway Interface), which originally was developed for use on UNIX computers. • When you use CGI, the URL points to a program file on the Web server. • The file is an executable binary file that is loaded and executed by the Web server when a browser requests that URL. iNet+ Guide to the Internet, Third Edition

  24. CGI (Common Gateway Interface) (Continued) • The program then builds a Web page that can be sent to the browser. iNet+ Guide to the Internet, Third Edition

  25. ISAPI (Internet Server Application Programming Interface) • Another protocol is ISAPI (Internet Server Application Programming Interface), which was originally developed by Microsoft for use on Windows NT servers that were using Microsoft Web server software, Internet Information Server (IIS). • The fundamental difference between a CGI program and an ISAPI program is the way the Web server relates to both. iNet+ Guide to the Internet, Third Edition

  26. ISAPI (Internet Server Application Programming Interface) (Continued) • First, remember that a Web server is an executable program. • With ISAPI, there is a lot of interaction because the Web server relates to the ISAPI program as its object or DLL. • Even though they are separate entities, each depends on the other for successful execution. iNet+ Guide to the Internet, Third Edition

  27. Active Server Pages (ASP) • Active Server Pages (ASP) technology by Microsoft is another step in the development of easier and more powerful ways to handle server-side programming. • ASP allows you to write a Web page with one or more scripts on the page. • The server executes the ASP script that uses the ISAPI method to call DLLs to do some of the work of customizing the Web page based on information sent from the browser and information about the server environment. iNet+ Guide to the Internet, Third Edition

  28. Active Server Pages (ASP) (Continued) • After the script has finished customizing the page, the Web server sends it to the browser. iNet+ Guide to the Internet, Third Edition

  29. Java Server Pages (JSP) • Sun Microsystems has developed Java Server Pages (JSP), which is a protocol similar to, and a competitor of, Microsoft Active Server Pages. • Java Server Pages can be used to include Java programming in HTML on a Web page. • Java is a programming language developed by Sun Microsystems from C++. iNet+ Guide to the Internet, Third Edition

  30. Java Server Pages (JSP) (Continued) • The short segments of Java commands inserted inside the HTML Web page by JSP are called Java servlets, which are small Java programs that run on the server. • A JavaBean is a small Java object that works as a reusable component in many different situations. iNet+ Guide to the Internet, Third Edition

  31. SAPI and JSAPI • Web sites also provide competing technologies for speech recognition. • Microsoft offers Speech Application Programming Interface (SAPI) and Sun offers Java Speech API (JSAPI). • In addition, Sun has developed a markup language called Java Speech Markup Language (JSML) that uses JSAPI. iNet+ Guide to the Internet, Third Edition

  32. Server-Side Includes (SSI) • Server-Side Include (SSI) is a simple, one-line form of server-side scripting. It has own protocols that allow you to use variable values, which can be included in the HTML code before it is sent to the browser. • SSI lets you include a line in the HTML file that indicates that a variable value needs to be entered before the file is sent to the browser. iNet+ Guide to the Internet, Third Edition

  33. Programming Languages Used by Server and Client • Many programming languages can use either the CGI or ISAPI specifications. • ASP can be used by only three scripting languages—VBScript, PerlScript, and JavaScript—and SSI is limited to a few HTML tags. iNet+ Guide to the Internet, Third Edition

  34. Perl • Perl (Practical Extraction and Report Language) originally was written for shell scripts for the UNIX operating system. • In certain situations, Perl can be used on the client. • Netscape Navigator supports a Perl plug-in that allows it to run some Perl scripts and applets downloaded from Web sites. iNet+ Guide to the Internet, Third Edition

  35. C and C++ • C is a popular programming language developed in 1972 by Bell Laboratories and later standardized by the American National Standards Institute (ANSI). • The language is compiled, meaning that the file containing the original list of commands is input into another program to generate a binary encrypted file that becomes the executable file. • This file customarily has an .exe file extension. iNet+ Guide to the Internet, Third Edition

  36. C and C++ (Continued) • C++ is an updated evolution of C that uses an object-oriented approach to programming. • C++ is available on most operating system platforms, including UNIX, Windows, and Macintosh. • The C++ language provides many objects and can make use of other objects provided by the operating system. iNet+ Guide to the Internet, Third Edition

  37. Java • Java is another object-oriented language that was developed by Sun Microsystems. • Small Java programs can be downloaded from a Web server and executed by a Web browser if the browser is capable of interpreting Java code. • These small Java programs are called Java applets. iNet+ Guide to the Internet, Third Edition

  38. PHP • PHP (Hypertext Preprocessor) is a scripting language originally developed by the Apache Software Foundation for the Apache Web Server on a UNIX platform, although it has been ported to other Web servers and operating systems. • It can relate to a Web server using the CGI protocol, is easy to learn and use, and is free. iNet+ Guide to the Internet, Third Edition

  39. Visual Basic • Visual Basic (VB), by Microsoft, is a very popular language because it is relatively easy to learn and, because it is written by Microsoft, interacts well with Windows operating systems. • Just like C and C++, Visual Basic is a compiled language - the program is an executable binary file. • Visual Basic can use DLLs effectively and is an object-oriented language. iNet+ Guide to the Internet, Third Edition

  40. VBScript, PerlScript, JavaScript, and JScript • VBScript is a subset of Visual Basic for Applications, which is a subset of Visual Basic. • VBScript is the default scripting language of ASP. • PerlScript is an off-shoot of and is similar to Perl - it uses some of the same code and functions. • JavaScript, developed by Netscape for use with Netscape Navigator, resembles Java, but is not a subset of Java in the way that VBScript is a subset of Visual Basic. iNet+ Guide to the Internet, Third Edition

  41. VBScript, PerlScript, JavaScript, and Jscript (Continued) • JavaScript is interpreted by most browsers and is the scripting language of choice if you want to serve the most Internet users. • To compete with JavaScript, Microsoft developed a similar scripting language called Jscript, but there are slight inconsistencies between the scripting languages and the way Netscape Navigator and Internet Explorer interpret each. • The new hybrid version of the scripting language is called ECMAScript. iNet+ Guide to the Internet, Third Edition

  42. Learning to Use Scripts • All you need to execute a client-side script is a browser; therefore, a beginner can easily practice client-side scripting. • Learning to use server-side scripts requires a Web server to interpret the script. • For an SSI or ASP script, you must type the script into the Web page, publish the Web page to the server, and then use your browser to access the page. iNet+ Guide to the Internet, Third Edition

  43. Learning to Use Scripts (Continued) • When you want to insert scripts on a Web page, you must include tags to mark the beginning and end of the script. iNet+ Guide to the Internet, Third Edition

  44. Learning to Use Scripts (Continued) iNet+ Guide to the Internet, Third Edition

  45. Including the Date on a Web Page • In the JavaScript example listed on page 570 and shown in Figure 9-22, the script retrieves and displays the system date. iNet+ Guide to the Internet, Third Edition

  46. Adding a Button to a Web Page • The next example introduces HTML commands that add a button to the Web page. • When a user clicks the button, a message appears in a box. • JavaScript commands are used to create the box and its message. • The program uses the onClick command, which calls a specific function when the button is clicked. iNet+ Guide to the Internet, Third Edition

  47. Adding a Button to a Web Page (Continued) iNet+ Guide to the Internet, Third Edition

  48. Creating a Script that Checks for Errors in User Input • In the example on page 574 of client-side scripting, you see how a script can validate data before the data is sent to the server for processing. • Make sure to validate data so bad data is not accepted when a user clicks the Send button. • This Web page displays a message to the user and invites the user to enter her name and e-mail address, and then click the Send button to send the data to the server. iNet+ Guide to the Internet, Third Edition

  49. Creating a Script that Checks for Errors in User Input (Continued) • The client-side script verifies that the e-mail address contains the @ symbol. • When the user enters correct data in the form on the errorchk.htm Web page, the form on the page sends the data to another Web page on the server. iNet+ Guide to the Internet, Third Edition

  50. Server-Side Scripting • One important job that can be performed by server-side scripts is maintaining a conversation between a Web browser and a Web server. • A Web server keeps no records of previous requests from a Web browser or replies to those request. iNet+ Guide to the Internet, Third Edition

More Related