Executing Logic in the Browser
Uniface provides extensive support for executing logic in the browser, making it possible to reduce unnecessary data exchange between the client and the server.
Rich web applications usually need to be highly interactive and responsive. If large amounts of data need to be exchanged with the server frequently, this tends to slow response time. It is therefore useful to limit the amount of data that needs to exchanged and keep client-server round trips to a minimum.
One of the ways in which you can achieve this is by having the client (browser) execute as much logic as possible. There is often enough information available on the client to process actions, so that round-trips to the server are only required for actions that need to query or store information.
Logic that is executed in the browser is implemented as JavaScript, a popular scripting language supported by all major browsers. To make it easier for developers to create and use JavaScript in web applications, Uniface provides the following for use in dynamic server pages:
- JavaScript APIs that enable you address and manipulate Uniface objects, data, and components in the browser. For more information, see APIs: JavaScript.
- The webtrigger and weboperation ProcScript statements to define client-side triggers and operations, which are run on the client instead of the server. For more information, see Client-Side Triggers and Operations.
- The javascript (and endjavascript) ProcScript instructions to specify blocks of JavaScript code in client-side triggers and operations.
- The webactivate ProcScript statement, which can be used in the server to activate an operation on the client.
- Support for JavaScript in both the Uniface IDE and runtime environment, so that you can write JavaScript code using the ProcScript Editor and have it added to HTML pages generated by dynamic server pages.
- Support for customer JavaScript definitions of triggers and operation that can be added to DSPs without the need to define it using the ProcScript Editor.
Note: To effectively use this functionality, you should be familiar with the concepts and syntax of JavaScript. For more information, consult one of the numerous books and internet resources on the subject.