Active Server Pages--the Host and the Scripting Languages

Active Server Pages—the Host and the Scripting Languages

The host. Sounds ominous. The host simply refers to the script host that exists on the IIS web server. A script host defines the properties of a script language, its syntax, and all execution rules. For example, the Microsoft Windows Scripting Host is an example of the ASP script host. It reads and executes the following script languages:

VBScript A subset of Visual Basic for Applications (VBA). We mention this one first because it's the default ASP scripting language and it's the language we'll be using with our Dreamweaver MX examples.

JScript Microsoft's counterpart to JavaScript. JScript is packaged with ASP. Neither is connected to Sun's Java language, although you might consider them similar. Many developers consider JavaScript the common standard for browser (client-side) scripting.

Warning 

Personal Pet Peeve: People often refer to JavaScript as Java. They are not the same thing—not even close. Don't do it. If you catch someone doing it, pinch them. Pass it on.

PerlScript A subset of Perl, which has been around for a long time. It's used mostly with text. It doesn't come with ASP, but you can download it from www.activestate.com. Since the ASP default is VBScript, you must include the option <%@language=PerlScript%> in your ASP document.

start sidebar
Client-Side and Server-Side Scripting

Client-side scripting in web development refers to manipulating the browser and its HTML contents. As you know, the server sends web pages to the requesting web browser, the client. Once the web page leaves the server, the server can no longer affect the page in any way. Therefore, any page manipulation must occur on the client side through the web browser. Most web browsers have a built-in scripting component that lets you manipulate the contents of an HTML page. You can use client-side scripting to tell a browser to carry out many tasks with JScript, VBScript, and JavaScript. A perfect example of client-side scripting is a roll-over image. Many sites use JavaScript to tell the browser to swap one image for another as you roll your mouse over the image.

Server-side scripting in web development refers to programmatic tasks carried out by the web server before it delivers HTML content to a web browser. A good example of server-side scripting is connecting to a database, retreiving a list of states, and creating the HTML code to display the list.

end sidebar

As we've mentioned, you can use ASP to combine HTML and JScript or VBScript scripts to dynamically serve HTML. When a browser requests an ASP page from an IIS web server, the server processes the VBScript or JScript code and forwards the HTML result to the web browser.

The IIS web server determines which files are ASP script pages by the extension in the filename. If the filename has an .asp extension, the server searches the contents of the file for blocks of ASP script.

The server can differentiate blocks of ASP script from HTML because ASP script always begins with <% and ends with %>. If both opening and closing tags are found, the web server examines and attempts to execute the script between the opening and closing tags. (All our ASP examples are wrapped by the beginning and ending ASP script tag.)

start sidebar
What You Need to Run ASP Script Files

If you are new to ASP development and you have not yet created your ASP development environment, you have two options. The first is obtain access to an IIS web server. The second option is to download the free Microsoft Personal Web Server from www.microsoft.com. Personal Web Server installs a mini–web server on your computer that can execute ASP script files. Although the first option is preferable, the second option will certainly work. For more information about IIS and Personal Web Server, visit www.microsoft.com.

An alternative to running a Microsoft web server is to run the Sun ONE Active Server Pages (previously Chili!Soft ASP.) Sun ONE Active Server Pages enables the Sun ONE and Apache web servers to run ASP web applications on Sun Solaris, Linux, Microsoft Windows, HP-UX, and IBM AIX operating systems. For more information about Sun ONE Active Server Pages, visit www.chilisoft.com.

end sidebar



Mastering Dreamweaver MX Databases
Mastering Dreamweaver MX Databases
ISBN: 078214148X
EAN: 2147483647
Year: 2002
Pages: 214

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