Introduction

Using Natural for Ajax, you can create rich internet applications using Ajax (Asynchronous JavaScript and XML) technology.

Natural for Ajax enables Natural users on Windows, Linux and mainframe platforms to develop and operate Natural applications with a browser-based user experience, similar to GUI desktop applications.

Adding to flexibility, Natural for Ajax also allows building browser-based user interfaces driven by Java applications or a mix of Natural and Java.

In contrast to many other tools for building browser-based applications, Natural for Ajax requires no in-depth knowledge of HTML and/or JavaScript.

Natural for Ajax can convert existing Natural maps to Natural for Ajax pages. Or, just run existing Natural maps in the browser without conversion.

This document covers the following topics:


What is a Rich Internet Application?

Classical HTML- and browser-based applications suffer from known disadvantages: The server's response time increases with each user interaction, rendering a new page in the browser, thus discontinuing the user's workflow. In contrast, classical GUI applications suffer from the prerequisite of installing an application's client component on each client machine.

Rich internet applications based on Ajax technology overcome such disadvantages as they combine the browser-based application's accessibility with the rich user interface of GUI applications.

Rich Internet Applications with Natural

At runtime, a rich internet application with Natural has the following structure:

  • A Natural host session on a Windows, Linux, or mainframe server runs the application code. Other than with a map application, the application does not deal with user interface issues. It contains only the application logic and communicates with the user interface layer by sending and receiving data. The data displays as a page in a web browser. Events, such as button clicks raised by the user in the web browser, are passed back to the application code. The application code receives the data modified by the user in the web browser along with such an event. The event and the data are processed and returned to the web browser page.

  • Natural for Ajax, running on an application server, receives data from the Natural application and merges it into an HTML page, delivered to the web browser. In the inverse direction, Natural for Ajax forwards events that the user raised in the web browser along with the modified data to the Natural application.

  • A web browser renders the HTML page. JavaScript code on the page processes local user interaction and exchanges data with Natural for Ajax as needed. It uses Ajax technology to exchange data with the Natural application in the background without re-rendering the complete page.

At development time, creating a rich internet application with Natural proceeds as follows:

  • Ajax Developer of NaturalONE is used to develop the user interface layout of a web page and to bind the controls on the page to data elements in the application.

  • When the user saves the page layout, a Natural module of type "Adapter" is generated. The adapter serves as an interface between the application code and the page layout. It contains:

    • a data structure that describes the data that the Natural application has to deliver to the application server to populate the web page.

    • the Natural code necessary to transfer the data structure to the user interface and to receive modified data back.

    • a code skeleton in the form of comment lines that provide handlers for the expected events. The application programmer can copy this code skeleton into the main program to implement the event handlers.

  • Then a main program is implemented that exchanges data with the web page using the adapter and handles the events. The event handler code is not aware of the web page's layout and operates exclusively on the page data sent and received through the adapter.

  • Finally, the navigation between different pages is implemented: A rich internet application navigates between pages just as a map application would navigate between maps.

Natural Maps in Rich Internet Applications

With the support of Unicode, Natural has introduced the Natural Web I/O Interface that renders Natural maps in a web browser. Rendering is based on HTML elements. However, rich internet pages contain much more advanced HTML elements that provide a much better user experience.

When coming from map-oriented applications and planning to switch to rich internet pages, such projects happen gradually: In certain parts of an application, rich internet pages may replace maps, and other parts of an application will possibly be left unchanged. To support such gradually conducted projects, Natural can run "mixed" applications consisting of both, maps as well as rich internet pages. Seamless navigation between Natural maps and rich internet pages is supported.