FormsNext

Chapter 1: Overview of Internet Programming

This chapter explains what is meant by an Internet application, and what its different components are.

1.1 Overview

An Internet application is a client-server application that uses standard Internet protocols for connecting the client to the server. You can use exactly the same techniques to create a true Internet application, which is available publicly through the World-Wide Web, or to create an intranet application. An intranet application is one which runs on your corporate intranet, and is only available to the staff in your corporation. Whenever we talk about Internet applications, we mean either true Internet applications or intranet applications. For an introduction to the World-Wide Web, see the appendix Introduction to the World-Wide Web.

Internet applications are thin-client, thick-server. This means that the client end, the part the end-user sees and interacts with, is only responsible for the user-interface. The client runs on a Web browser - the standard tool for accessing the Internet. All the processing is done at the server end, where your corporate data is.

Because your applications use standard Internet protocols for client-server communications, you can make your applications cross-platform. The server-side programs are written in Micro Focus COBOL, so you can run them on UNIX servers or Windows NT (you need to purchase Micro Focus NetExpress to run applications on Windows NT).

The server-side program for an Internet application communicates with the client through the Web server software for the machine. The interface between a COBOL program and the Web server running it is transparent to the programmer, and you can use two interfaces without code changes:

These are explained in more detail in the chapter Building Internet Programs. By default, all applications created with Server Express are built for use with CGI (supported by all Web servers), and we recommend that you develop and debug applications using CGI. You can convert any COBOL CGI program to NSAPI by changing compilation and build settings, and rebuilding the program. However, to obtain the full advantages of a NSAPI program, it should be thread-enabled.

The client-side user-interface can be written using standard HTML forms which can be used by any forms-capable Web browser; the user interferace can therefore be deployed on UNIX, Windows, Macintosh or OS/2.

1.2 What does an Internet Application Look Like?

Internet applications are client-server applications, and can be split into two pieces:

The form is the part your end-user sees. It is displayed in a Web browser, and provides controls through which your end-user can enter data. The picture below shows you a simple form:



Figure 1-1: A simple form for an Internet Application

When the end-user clicks the Send Form button, the information on the form is packaged, and sent to a server-side program. The server-side program only runs when it is started from a form, or from a link on a Web page. The server-side program processes the information on the form, and returns a result to the end-user.

Depending on what the program does, the result is displayed on another form, or perhaps a simple HTML page showing text.

1.2.1 More Complex Applications

The example above is very simple. Real applications are likely to be more complex, and could consist of several forms and server-side programs linked together. We have categorized server-side programs into two types:

Asymmetric server-side programs enable you to build up complex applications by chaining together different forms and server-side programs. The diagram below shows an application where the output from the first program starts a second server-side program. The second program outputs different forms depending on its processing path.



Figure 1-4: A more complex application

1.3 Execution Flow

A server-side program only runs for long enough to process some data and return a result. The end-user has the illusion that the application is running all the time, when the application in fact consists of a series of transactions which run for a short time and then disappear.

An application based on a symmetric server-side program (see the previous section for an explanation of this term) works like this:

  1. An end-user clicks a link on a Web page which starts a server-side program running.

  2. The server-side program runs, and sends back an HTML page, containing a form for the application.

  3. The end-user fills in the form and clicks a button to submit it.

    This runs the server-side program again.

  4. The server-side program fetches some data, and returns it to the end-user's browser in the form.

There are many possible variations on the above sequence. For example, the demonstration CGI application supplied with Server Express (use Infomgr to access demonstration applications) starts with an input form, which executes a CGI program that returns a simple HTML page. The types of asymmetric server-side program discussed briefly in the previous section might be more complex, but the essential point is that server-side programs only run long enough to return a result.

1.4 Form Programming

Most of the focus of this book is on writing server-side programs that process data from a form, and return a result. However, you can also put interactive code into the form itself. You do this using JavaScript, a simple scripting language supported by Netscape browsers. When you script a form, you write JavaScript functions, and link them to events on the form. A function linked to an event is known as an event handler. For example, you can write an event handler to verify that the value in a particular field lies in a given range when the end-user has finished entering data.

More advanced JavaScript functions, such as those for data validation require some extra programming. However, if you want to code more advanced JavaScript you need to learn more JavaScript than this chapter covers. The Netscape JavaScript Authoring Guide on the Netscape Web site is a good source of information. The link given here is to the Guide for JavaScript V2.0, which is fully supported by Netscape Navigator V2.0 and later, and partially by Microsoft Internet Explorer 3.0.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

FormsNext