Chapter 1 Programming Languages for Web Applications Introduction Web-related programming tasks include HTML page authoring, CGI programming, generating and parsing HTML/XHTML and XML (extensible Markup Language), creating dynamic HTML pages, writing HTTP clients and servers applications, Web site management, and Web applications. Programming languages used by Web programming professionals include HTML/XHTML, XML, Java, Java Server Page, JavaScript, VBScript, Visual Basic, Active Server Page (ASP), C/C++, PHP, Perl, ASP.NET, VB.NET, and C#.. 1.1 HTML (HyperText Markup Language) and XHTML The HTML is a structure language with a formal definition for use in creating static Web pages or HTML documents that we request from Web servers around the world. A typical Web page may include the following information: Text of its document with appropriate settings such as front, color, alignment, numbered and bulleted lists, etc; any hypertext links to other documents, images, and other media; tables and user feedback form Embedded client-side scripts such as JScript Embedded images and media Embedded other objects such as Java Applet program, ActiveX, audio, video, and VRML objects Embedded video, audio, and other formats via Plug Ins XHTML 1.0 Standard HTML 4.01 was approved by W3C (World Wide Web Consortium http://www.w3.org/markup) in 1999 XHTML 1.0 was approved by W3C in early 2000 for replacing HTML 4.01 Just like HTML 4.01 but it was modified to conform to the XML standard 1-1
All XHTML tags are case sensitive DOCTYPE document type xmlns XML Name Spaces Editing HTML/XHTML Documents Text editors: Microsoft s Notepad, Wordpad, Word UNIX/LINUX s vi, emac, pico Save the files with either an.html or.htm file-name extension XHTML Document Structure <?xml version = 1.0?> <!DOCTYPE html PUBLIC -//w3c//dtd XHTML 1.0 Strict//EN http://www.w3.org/tr/xhtml11/dtd/xhtml-strict.dtd> <html xmlns=http://www.w3.org/1999/xhtml > <head> <title The First XHTML Page ></title> </head> <body> <p> The First XHTML Page Welcomes You! </p> </body> </html> 1.2 DHTML (Dynamic HTML) DHTML, Microsoft Dynamic HTML uses a number of technologies such as HTML, script, a Document Object Model, multimedia players/components, absolute page positioning, dynamic styles, data binding to a page, and so forth to give your Microsoft Internet Explorer browser the ability to interactive with all elements of a Web page and to allow it to manipulate dynamic contents dynamic styles dynamic positioning 1-2
1.3 extensible Markup Language (XML) The XML is standard language from World Wide Web Consortium for putting structured document and data in a text file for use on the Web. It uses tags and attributes like HTML, but XML allows users to define their own tags for delimit pieces of data, and leave the interpretation of data completely up to other applications. Features of XML include: Another file format for storing information in hierarchical formats XML documents can describe both themselves and their content Meta-language that allows you to create and format your own document markups XML specification: http://www.w3.org/xml 1.4 JavaScript JavaScript is a scripting language developed by Netscape for used in delivering dynamic Web pages, and enabling client-side programming for interactivity. JScript is a Microsoft version of JavaScript. ECMAScript (European Computer Manufacturer's Association: www.ecma.ch/stand/ecma-262.htm) ) is a standardized JavaScript/JScript. A dynamic Web page may contain JavaScript code, which is placed inside a <script> element and will be executed as the Web page is loaded into a Web browser. It may be used to monitor various user events and response to various user requests. Typical JavaScript applications may include Customizing Web pages Creating dynamic Web page Validating user form for CGI Manipulating cookies Interacting with frames Calling Java program 1.5 VBScript 1-3
VBScript, a scaled down version of Microsoft' Visual Basic, allows active scripting to be added on Web client (IE 3.0 and up), and Web server scripting in Microsoft Internet Information Server (version 3.0 and up). 1.6 Perl Perl (Practical Extraction Report Language) is a portable, interpreted language used primarily as a tool for writing scripts that perform such functions as: Manipulate text in files Manipulate files and processes Extract data from files Write reports Perform networking tasks Write CGI scripts to generate dynamic pages for form processing Interface to databases 1.7 Microsoft Visual C++ Visual C++ include many MFC library classes for supporting Internet and Web programming: CGI programming Winsocket WinInet is a higher-level API than Winsock supporting only HTTP, FTP and gopher client programs. IIS's API or the MFC (Microsoft Foundation Classes) ISAPI server extensions classes ODBC (Open Database Connectivity) for SQL Database access and DAO (Database Access Objects) MFC support for ActiveX document servers ActiveX controls 1.8 Java 1-4
A general purpose programming language that can be used to create Applets that execute after the Web page is loaded. It is also used for writing server side applications. Features of Java Secure - virus-free, tamper-free Robust - not memory overwrite Portable - run on different machine without change Java Components The Java compiler - translate Java code to byte code The Java interpreter - reading and executing Java byte code The applet viewer Terms Byte Code - A highly portable machine language for an imaginary Java computer Java Virtual Machine (JVM) - a computer that runs Java byte code Just-In-Time (JIT) compilation - some JVM can translate byte code into machine language Java Programs Java stand alone applications (console or window-based) Java applets Java applet Small Java programs that run in a JVM and is incorporated into a Web Browser An applet runs inside a Web browser or an applet viewer An applet cannot manipulate the computer file system An applet is launched from HTML page Java class extends java.applet.applet Defined in the java.awt package Java Applications Network programming (java.net) Applet for dynamic Hypertext Markup Language document (Java.Applet) 1-5
Graphical User Interface Stand-Alone Programs Programs that runs on the computer in the same manner as any other windowbased application 1-6