CS 100 (Learn)CS 100 (Web)Module 09


Dynamic Web - Server-Side Dynamic Web Pages

The first type of dynamic web pages we will explore are known as Server-Side dynamic pages, because the pages are changed dynamically by the web server.

Earlier, we described the scenario where a web server receives a request for the reference ~YOURUSERNAME/hello.html and then responds by providing a file that already exists named hello.html.

Instead of just fetching an HTML file that already exists, the web server could generate a new web page.

Consider what happens when you enter https://www.google.com/search?q=rick+astley in a web browser.

The dynamic web page that appears was automatically generated. It is not a statically generated page that was prepared in advance, just in case someone wanted to perform that particular search.

There are many reasons why a static page strategy would never work for google search, but one that you may not have considered is that every day google receives millions of unique searches that have never been searched before in the history of google.

Google's search web server runs very sophisticated software that searches through billions of web pages and then automatically generates an HTML page that contains all of the recommended search results. For now, if it helps, you can imagine that Google search is like a very advanced version of Excel's VLOOKUP function.

Actually, the comparison to VLOOKUP is much closer to the way that an online retailer such as Amazon provides dynamic web pages. There are web servers available for small businesses where the merchandise information is actually stored in Excel spreadsheets. When a retailer wants to make changes (e.g. update prices, change product descriptions, add new products) they simply modify a spreadsheet that is stored on the server. When a client visits the webpage, the information is retrieved from the spreadsheet and then the HTML page is automatically generated.

In practice, web sites usually use advanced databases that are more sophisticated than Excel. But, although we are oversimplifying the process a little, the basic concept of what is happening is not much different than what we have described.

When you visit a product page on Amazon, there are a large number of dynamic elements on the page. For example:

In addition, there are dynamic elements on the page that are specific to the "person" viewing the product. For example:

Before we see how some of these elements are generated, we will learn a bit more about client-side dynamic pages.