The inability to save information, or state, throughout a session is one of HTML’s major limitations. HTML has no client/server type variables that remember things as the user moves from page to page. For example, if we want to use a piece of information entered by a user on the first page of a web system, we must save it somehow and be able to recall it later. There are four basic ways to do this: saving the information as part of a query string in a URL, saving it in a hidden field, saving it in a database table, or saving it in a cookie file by using the OWA_COOKIE package, described later in this section. In this section, we’ll look at each method and discuss possible problems you may run into.
The first way to maintain state, using a query string of a URL, is
the most straightforward: you simply build the string as you go,
placing the information you want to pass from screen to screen in
name/value pairs. These values are then passed to the procedure
specified in the URL’s
href attribute when
the user clicks on the hyperlink. The disadvantages to this approach
include the following:
Depending on the system, the maximum length of the URL is limited to 256 characters.
Each value must be encoded to the CGI specification. It can be easy to forget to do this if you’re in a rush.
The second way to save state information is to store it in hidden fields. A hidden field is simply an invisible input element that is part of an HTML form. Although the user cannot see the ...