Introduction to Server Side Scripting
Basic overview of server-side scripting
We have learnt to display information on an Internet browser through HTML and to check information the user has entered in HTML forms. These tasks, however, constitute just the tip of the iceberg of web development. Programs, database operations, and scripts that run on the server and provide dynamic response to the user from the server make up a bulk of web development artifacts. These programs either process information from the user (HTTP requests) or prepare and format responses to the user. The Design and Implementation of sets of domain specific programs is referred to as Web Application Development
Figure 7a: Server Side Scripting
Server Side Scripting tools are among the simplest web application development tools. They are widely used and indispensable. They are closely intertwined with the actual HTML web page content and its generation and are very easy to understand and implement. Any program on the server that processes client requests such as form submissions from the web browser is a server side script. Basically, server side scripting consists of embedding lines of commands and programs in html files using special markup. The server recognizes a script by its extension and processes it accordingly. The file extension of a script is never .html or .htm. but rather an acronym of the scripting language used within the file. The server recognizes the script through the extension. Commands and procedures within the script are enclosed in special markup, for instance pairs of '%' signs or '$' and so on. The web server executes all these commands and sends the result (which is now plain html) to the client.
Server side scripting tools include Microsoft's Active Server Pages with VBScript syntax, Cold Fusion with Allaire's ColdFusion Markup Language, PHP pages (originally known as "Personal Home Page Tools") with PHP markup, and JSP or Java Server Pages from sun. Documents that contain server-side scripts usually have the following extensions: *.asp for Active Server Pages, *.cfm or *.cfml for ColdFusion, *.php, *.php3, or *.phtml for PHP pages, and *.jsp for Java server pages.
Java servlets are similar to server side scripts. Servlets, however, are actual programs that may call other programs, perform a series of tasks, or generate web pages as opposed to commands, directives and code fragments embedded in html. Server side scripts sometimes contain a hodgepodge of database code, HTML page design code, and control flow code in the scripting language. The entire application looks cleaner and becomes a lot easier to maintain when these concerns are separated. Servlets, besides being more efficient, offer a way to separate these concerns. Another way to accomplish this separation is to use a Model-View-Controller (MVC) architecture. The Model represents the database code, the View represents the page- design HTML code, and the Controller represents the code that navigates through choices and carries out scripting directives ,i.e., the code that controls the display. Sun's Struts framework helps developers create web applications utilizing the MVC architecture. MVC can be simulated using Microsoft's ASP .NET framework that contains a next generation implementation of ASP called ASP .NET.
The web application we will learn to develop in the next couple of chapters is quite simple; we will augment the florist site by allowing customers to register and place orders online. We will use Microsoft's ASP to perform these tasks; an MS Access database will hold all our information while Microsoft's IIS will host our web application. In this chapter, we will set up the environment to develop our application and learn key database and ASP scripting concepts. We will work through a series of exercises and learn a variety of programming tasks in the next two chapters.
Note - Microsoft's PWS or Personal Web Server, available with all Windows versions other than XP and ME, will also answer. However, all the exercises are geared towards using IIS, which comes with Windows XP Professional (NOT XP Home). Also, neither PWS or IIS is available to users with XP Home.