Middleware Options

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 16.  Introduction to Web Applications


As I said earlier, middleware is software that handles most, if not all, business logic in a Web application. Over the past 10 years, as the Web has matured, dozens of different middleware options have appeared.

Most middleware options have a lot in common. For example, most of them interact with relational databases; they can process complex requests from Web browsers and can write files to and read files from a file system. So which option is the best for you? Most are pretty much the same, so choosing an option isn't just a case of features. Web developers soon discover that the most important criteria for selecting an option is its flexibility. Will this option allow them to easily access a database? Build objects to keep redundant code to a minimum? It's a lot like buying a pair of jeans: you want to go with what looks good and fits right.

The following sections describe some of the more popular options.

PHP

PHP has taken the Web by storm. More servers run more PHP pages than any other language. PHP is a lightweight, easy-to-learn, and quickly deployed open-source scripting language with a number of convenient features. The language's lineage is Perl and C, so many developers familiar with those languages will find making the switch (as I did) very easy. Every day, more and more modules are added by a growing community of open-source developers.

PHP works very well with many database solutions, but it is almost always mentioned in the same breath as the mySQL database system. PHP can run on Windows, Unix, and Mac servers; it supports IIS, Apache, and other Web servers.

As for functionality, PHP supports object-oriented programming, nesting of modules, and custom functions. It has a rich set of built-in tools that let you access XML files, mail servers, database archives, Java APIs and objects, the server's file system, and a lot more.

PHP commands (or directives) are embedded into HTML pages between special tags (<? ?>). These directives are handed off to the PHP engine by the Web server, which then processes the directive and hands output back to the Web server for display in the Web browser. For example, the following code snippet will print "Hello there!":

 <html>  <title>My first PHP</title> <body> <h1>My first PHP</h1> <? echo "Hello there!"; ?> </body> </html> 

PHP pages are usually created as templates that hold HTML and directives for displaying dynamic content. In this way, PHP (and other middleware options) can save you a lot of time in developing and deploying a site.

Figure 16.4. PHP code in Dreamweaver MX.

graphics/16fig04.jpg

For more information on PHP, refer to Chapter 24, "PHP and MySQL."

ColdFusion MX

Macromedia ColdFusion MX is described as a rapid server-scripting language for creating Web applications. It uses a language called ColdFusion Markup Language (CFML) to interact with databases and dynamically create pages.

CFML tags are embedded directly into HTML, and each command has a start tag and an end tag, which look like this:

 <cfmytag> </cfmytag>  

Each ColdFusion application is a set of pages with CFML commands in them. Developers can use the built-in functions, create their own, or integrate COM, C++, or Java components into their code.

ColdFusion supports both JDBC and ODBC data sources.

ColdFusion MX is an integrated development environment (IDE) that can be run as part of a suite with Dreamweaver. The ColdFusion IDE allows developers to develop, test, and deploy ColdFusion applications.

ASP

ASP, or Active Server Pages, is a Microsoft-developed Web-scripting language. Like many other middleware options, ASP allows you to embed special instructions in HTML pages that can do a variety of tasks, such as connect to a database, perform looping instructions, and conditionally test for certain values.

ASP runs natively on Microsoft's IIS Web server. Although ASP is normally written in VBScript (a derivative of Visual Basic), it also supports JavaScript, ActiveX Data Objects (ADOs), and even PerlScript.

ASP directives are placed between special tags in HTML, which look like this:

 <HTML>  <TITLE>My First ASP</TITLE> <BODY> <h1>My First ASP</h1> <% Response.Write("Isn't ASP cool?") %> </BODY> </HTML> 
Figure 16.5. ASP code in Dreamweaver MX.

graphics/16fig05.jpg

For more information on ASP, refer to Chapter 22, "ASP and ASP.NET."

ASP.NET

ASP.NET, or ASP+, is Microsoft's next generation of the ASP line. ASP.NET supports compiled code written in C++, C#, Perl, and Visual Basic and allows separation of code from HTML formatting (called "code behind method"). Because the language can be compiled, it can run faster than its interpreted predecessor, ASP.

Although ASP.NET isn't compatible with ASP, the two can run side-by-side on the same server.

For more information on ASP.NET, refer to Chapter 22.

JSP

Java Server Pages, or JSP, is an extremely popular and robust middleware option. JSP brings together the power and portability of Java with the native UI-rendering capabilities of an HTML browser.

JSP can run under the control of a servlet (the most popular is Tomcat) or it can integrate with Java Beans, which are bits of compiled code that can do various functions (such as access a database or return search results).

JSP is a full development language with robust object-oriented features and extended capabilities that make it the right choice for building extensive, complicated applications.

Like many other middleware options mentioned here, JSP tags are embedded directly into HTML, and look like this:

 <html>  <title>My First JSP</title> <body> <h1>My First JSP</h1> <% out.println("JSP is cool!"); %> </body> </html> 

For more information on JSP, refer to Chapter 23, "JSP."


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net