Quick Nav
See Also
Web Frameworks
To create dynamic web pages, you need a convenient and powerful server-side scripting environment. It is slow and difficult to create a functional and appealing web application using the legacy CGI protocol. It's interface is too low level and it provides little assistance to manipulate server-side data, render UI elements and manage Ajax interactions.
In contrast, environments such as Ejscript, Rails or even PHP provide much more support for dynamic web content.
Appweb provides a rich set of options to use when creating web pages or web applications. This document compares the alternatives and suggests where each option is best deployed.
Comparison
The following table summarizes the differences between the various web application environments.
CGI | EGI | Ejscript | PHP | Handler | |
Target Use | Legacy dynamic pages and forms | In-memory form processing | Dynamic embedded web pages and forms | Enterprise web pages and forms | Custom URL processing |
Typical Memory Footprint | External program. 500K | 20K | 200K | 4-8MB | 20K |
Performance | Slow | Very fast form processing | Very fast page and form processing | Fast page and form processing | Fastest possible |
Advantages | Standard in wide-use | Simple fast forms processing | Easy creation of dynamic web pages | Large base of PHP code and developers | Allows any URL handling desired |
Disadvantages | Slow. Hard to visualize output | Limited to forms. Can't design page WYSIWYG | Relatively new | Very large memory footprint | Must build functionality |
Remarks | Use just for legacy CGI programs and scripts. Use Ejscript or PHP instead. | Use just for simple forms.. | Preferred in embedded applications and devices. | Use where memory footprint is not a concern. Useful for enterprise web applications. | Use for custom HTTP processing. |
In summary, we recommend using Ejscript for embedded applications and devices and PHP for enterprise and legacy applications.
Ejscript
The Ejscript Web Framework is a web application environment that uses server-side JavaScript and a Model / View / Controller paradigm. It provides an application generator, templating engine, a powerful Model/View/Controller framework and a library of Ajax view controls.
Ejscript was designed to make it dramatically easier to create dynamic web applications and it excells when embedded in applications or devices. It is also ideal for back-end hosting of applications behind a reverse-proxy.
Ejscript has a very small memory footprint (~300 including the JavaScript) and yet offers a powerful suite of features:
- Server-side ECMA-262 compliant JavaScript language
- Compact and fast JavaScript virtual machine
- Extensive system class library with classes for Events, Timers, File I/O, Streams, Sockets, HTTP, XML, Regular expressions and SQL Database
- Integrated SQLite database
- SQL Object Relational Mapping (ORM) layer
- Templating engine
- High level user interface control (e.g. Smart Table and charting)s
- Support for leading Ajax libraries
- One line binding to C data and functions
For more information, please read Using Ejscript.
PHP
PHP is a widely-used general-purpose scripting language that is especially suited for enterprise Web development. It provides an object-oriented programming language, numerous extensions and a broad developer community. The power of PHP comes at a price, it typically has a memory footprint of 1-2 MB for the PHP code alone. For embedded systems, this is often too big and so we recommend using Ejscript for such systems.
CGI
CGI stands for the Common Gateway Interface and it is the legacy extension interface for running external programs to generate dynamic data. It is standard but slow. Unless you have legacy CGI programs or need to run a scripting language via CGI, you are better served by using either PHP or Ejscript.
EGI
The Embedded Gateway Interface (EGI) was implemented by Embedthis as an in-memory, faster replacement for CGI. It can be used to migrate and accelerate CGI programs by running them inside the Appweb address space. However, in most cases Ejscript can do everything that EGI could be used for and so Ejscript is a better choice.
Custom Handlers
Occasionally, you may require total control over how the HTTP server should respond to a request. Appweb allows you to create your own custom HTTP handler that can respond and process HTTP requests. This is useful if you have custom HTTP protocol extensions, proprietary authentication or authorization procedures or specific request timeout requirements.