Dynamic HTML


Let's face it, static Web pages like that shown in Figure 26.1 are pretty boring. Most Web sites you see on the Internet today are built using dynamic Web pages. As you might guess, dynamic Web pages have the capability to change their content in response to varying needs, including the interest of the user viewing the Web page. How is it possible to have Web pages on a server that can change?

Actually, the process of creating dynamic Web pages is quite simple. All we need do is insert a special pair of tags in the HTML file that surround non-HTML instructions for the computer processing the HTML. We'll examine the special tags later in the chapter. For now, let's examine the process of creating dynamic Web pages.

Unlike HTML files that end with .htm or .html , ASP.NET files end with .aspx . (The x at the end of the filename distinguishes ASP.NET files from the older Active Server Pages files that end with .asp .) These ASP.NET files usually contain a blend of pure HTML script and ASP.NET tags. It's what is contained within the ASP.NET tags that enables you to create dynamic HTML files.

On computers that have Visual Basic .NET installed, files that end with .aspx are sent to a special dynamic link library ( aspnet_isapi.dll ) for processing. That DLL looks for special tags in the file for subsequent processing. Simply stated, the DLL takes whatever it finds within the special ASP.NET tags, processes those instructions, and generates new HTML script from the instructions. The newly generated HTML is then combined with the original HTML script that was in the file. The newly processed HTML file is then shipped back to the client browser for display.

Server-Side and Client-Side Processing

Notice what has happened in terms of Figure 26.2. When the server determines that an ASP.NET file has been requested by the user, it performs additional processing on that file. In other words, we've added another server step to the process shown in Figure 26.2 because the server now performs additional processing on the file. Because the processing could involve information sent from the client as part of the request, the new HTML file that's sent back to the client can be tailored to the specific needs of the client. This illustrates server-side processing because the dynamic Web pages are built on the server.

It's also possible to have client-side dynamic Web pages. In that case, the client requests a file from the server, which the server returns to the browser. It becomes the browser's responsibility to process any special instructions that might be embedded in the HTML file. If it finds such special tags, it processes those instructions and generates the new (dynamic) HTML and then displays it.

Client-side processing seems to be losing ground to server-side processing. The primary reason is because not all browsers have the same processing capabilities. Whereas Internet Explorer may process a certain Web file perfectly , Netscape Navigator may not be able to understand the special instructions in the file. Because server-side processing always will have the necessary processing capabilities, they can always generate the new dynamic HTML to be sent back to the browser. Because all browsers can process HTML, there is less chance of a processing failure with server-side processing. That's the good news.

The bad news is that the client's horsepower is going to waste while an ever-increasing burden is being placed on the server. You might be sitting at home with a system that has more computing power than the world did fifty years ago, and all you're doing is displaying HTML. It's the old H-bomb-to-kill-an-ant syndrome. Still, until browser capabilities are standardized, server-side processing is going to be king of the hill. (However, because we're using Visual Basic .NET in conjunction with Internet Explorer, we're fairly safe in assuming that the two pieces of software are compatible.)

Now that you understand the difference between server-side and client-side processing, let's write a simple Web page that uses dynamic HTML and client-side processing. (It's pretty easy to find examples of server-side dynamic Web pages. Client-side examples are a little more difficult to find.)



Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon

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