What does Dynamic Web Application Really Mean ?

Sunday Aug 23rd 1998 by ServerWatch Staff

Having a web site is not a big deal. You can hire students from a university to do the work. To be honest, some students can do very good work for less expense. However, what happens after you have a web site is really a big deal.

Noppadol Weerakitti
Having a web site is not a big deal. You can hire students from a university to do the work. To be honest, some students can do very good work for less expense. However, what happens after you have a web site is really a big deal.

To make you have a clear picture of the difference between a normal static web site and a dynamic web application, I will use a Telephone Book application as an example.

A static web page Telephone book is just simply created with pure HTML which combines data and "decoration" in the same file.

Click Here to jump to a sample static Telephone Book web page and Here to a dynamic one. You can see that both of them look the same to the user view. However, there's a big difference from the administration view.

For example, adding new staff to the sample static Telephone Book is not a simple task. Why? Because the page lists the staff information in two different colors which makes the code of the page look look this:

<tr bgcolor=#FFFFCC>
<td>Angsana Narksang</td>
<td align=CENTER>1728</td>
<td align=RIGHT>Accounting</td>
<tr bgcolor=#FFCCCC>
<td>Buncha Sangdee</td>
<td align=CENTER>1734</td>
<td align=RIGHT>Purchasing</td>

The above code tells the browser to display the data row by row in different colors like this:

Angsana Narksang
Buncha Sangdee

Because the rows have to be sorted by name, then a new staff name Aumaporn Buawlert has to be inserted between Angsana and Buncha. The new page should be like this.

Angsana Narksang
Aumaporn Buawlert
Buncha Sangdee

All right, that means you have to change the color of all rows after Buncha and do it again and again when a new staff is added to the page. Not a good way, isn't it ?

How about the dynamic page ? Oh, it's a lot easier. Let's take a look at the code that generates the page:

<% Do Until RS.Eof % >
<% index = i Mod 2
<% If index = 1 Then
Response.Write "<tr bgcolor="#FFFFCC">"
Response.Write "<tr bgcolor="#FFCCCC">"
End If % >
<%= RS("FirstName") % >&nbsp;<%= RS("LastName") % >
<% i = i+1
Loop % >

Hey, don't worry about the code. It's just syntax. Look at the idea behind it first, OK.

The combination of HTML (black color) and Active Server Pages script (blue color) shown above is the main part which will produce the same result as the static page. OK, let's see what it really does.

First of all, all required rows of data will be generated as a Recordset, in this example called RS which is the result of the query "SELECT * FROM Tel_Book". In another words RS is a collection of all records in Tel_Book table. (Although, the code for generating the Recordset is not shown here, it's just 2 or 3 lines of coding)

After having a Recordset, it is used in the "For" loop to produce rows of records that are placed inside the HTML table.

For the "decoration", the script checks the value of a variable named index and changes the row's background color to either "#FFFFCC" or "#FFCCCC". This can make sure that any change in data will not cause any effect in the colors or vice versa, like the static page. And as you may know, this brings our application close to the basic principle of Object Oriented Programing or OOP, in some sense. And more than that, to add the new record is much easier than painfully editing the HTML file manually like you have to do with the static web page.

You can do it on our Example Page by just simply clicking the ">Add new staff" button located at the end of the table and fill in the form. After that the new staff name will be inserted into the page automatically, in the right position, right color and ... right time. Try it now!

With the same idea, you can add more functions to the page, for instance, editing the existing record, deleting the record which is ju1st a piece of cake.

And that's it. Dynamic Web Application.

Noppadol Weerakitti
Sample Static Telephone Book

Name Extension Department
Angsana Narksang 1728 Accounting
Buncha Sangdee 1734 Purchasing
Dungdee Areekul 1704 Accounting
Manop Suanchom 1757 Human Resource
Orasa Jamdee 1765 Marketing
Suntorn Sangdee 1722 Accounting
Teerawat Namsanok 1744 Purchasing
Veerasak Patana 1525 Administration
Noppadol Weerakitti
Sample Dynamic Telephone Book

<% Do Until rs.Eof %> <% index = i Mod 2 If index = 1 Then Response.Write "" Else Response.Write "" End If %> <% i = i+1 rs.MoveNext Loop %>
Name Extension Department
<%= rs("FirstName")%> <%= rs("LastName")%> <%= rs("Extension")%> <%= rs("Department")%>
Click the Add button and see how easy to add a new staff online, no upload/download or FTP. You can finish it in less than 1 minute. You can not do this with static web page.

Noppadol Weerakitti

Click here to see the result.(You may have to refresh the page)

<% Else%>
Add new staff record Form
  First Name  
  Last Name  
With help from Script language, you can make sure that all necessary data are filled-in. (Try press add button without fill-in data on First Name, or Last Name or Extension.) And with HTML control, you can avoid human error in typing by providing them a list of department in drop down listing control like above.
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved