• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 5. Passing Data Between Pages

Lesson 5. Passing Data Between Pages

The hallmark feature of dynamic Web pages is that the contents displayed in the browser are not coded in the page, as in static HTML, but rather inserted into the page on the fly as it is served. The implication of this is that the core skill in developing dynamic Web applications is knowing how to capture and embed data, so that it can be inserted into Web pages when they are served.

At the end of the preceding lesson, you got a taste of this process, when you displayed the first name that users entered on a form on a different page. To accomplish this task, you used ASP or ColdFusion code to capture the firstName variable and inserted it inline into regular XHTML code. Though it was a simple little application, the form-to-Web transfer you achieved at the end of Lesson 4 is representative of a good portion of dynamic site development.

In this lesson, you will pass data from a URL into a cookie on the user's hard drive to create persistent dynamic data.

You probably already know that there's a lot more to dynamic Web site development than forms and form variables. You know that you can embed database content in a Web page, and you have probably also heard of cookies, which store little bits of information on client computers for later use. Building dynamic Web pages, then, usually means working with several different types of data, coming from different sources, and outputting them into a standard XHTML page.

In this lesson, you will explore two other ways of capturing and embedding data in Web pages (also called binding). In doing so, you will discover how similar each of these approaches to binding data is to the other, from the perspective of coding. And yet you will also see that each approach offers unique benefits that the other approaches don't have. You will not do anything for Newland Tours in this lesson; nor will the files be particularly attractive or useful in themselves. But they will teach you quite a bit about the core skill of binding data to Web pages.

As you learn each of these approaches to binding data, you'll also learn more about the HTTP protocol that the Web uses. The nature of this protocol shapes the ways we bind data to Web pages, and understanding HTTP protocol basics takes a lot of the mystery out of the inner workings of dynamic Web pages. As the book progresses, in addition to form, database, and cookie data, you'll learn several more ways to bind data to Web pages, and when and why to use each technique.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn about the HTTP protocol, and how it enables developers to create dynamic sites

  • Discover the difference between GET and POST

  • Encode and retrieve querystrings

  • Encode and retrieve cookies

  • Create a cookie using dynamic data

APPROXIMATE TIME

This lesson takes approximately one hour and 15 minutes to complete.

LESSON FILES

Starting Files:

Lesson05/Start/newland/about.asp

Lesson05/Start/newland/contact.asp

Lesson05/Start/newland/generic_template.asp

Lesson05/Start/newland/index.asp

Lesson05/Start/newland/profiles.asp

Lesson05/Start/newland/test_form.asp

Lesson05/Start/newland/test_form_processor.asp

Lesson05/Start/newland/tours.asp

Completed Files:

Lesson05/Complete/newland/about.asp

Lesson05/Complete/newland/animal_home_page.asp

Lesson05/Complete/newland/animal_questions.asp

Lesson05/Complete/newland/contact.asp

Lesson05/Complete/newland/generic_template.asp

Lesson05/Complete/newland/index.asp

Lesson05/Complete/newland/profiles.asp

Lesson05/Complete/newland/test_form.asp

Lesson05/Complete/newland/test_form_processor.asp

Lesson05/Complete/newland/test_form_processor_cookies.asp

Lesson05/Complete/newland/tours.asp


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint