Creating Dynamic Web Pages

To create web pages with dynamic data, you need a convenient and powerful server-side scripting environment. Using the legacy CGI protocol is slow and difficult to create great looking web pages because you cannot see the result until it is rendered. In contrast, environments such as Embedded Server Pages or PHP allow you to see what the page will look like in WSYWIG tools like Dreameweaver.

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.

Embedded Server Pages (ESP)

Embedded Server Pages (ESP) are a collection of technologies developed by Mbedthis to provide embeddable, standards-based dynamic web page generation. Similar in its ultimate goal to PHP, Active Server Pages (ASP) and Java Server Pages (JSP), Embedded Server Pages enables the elegant creation of web pages by embedding scripting in the HTML page to access and compute dynamic data. This allows the use of  page layout tools such as Dreamweaver to create and layout the page.

Embedded Server Pages was designed exclusively to be suitable for embedding in applications and devices. It provides a close binding between your application and the web page to be displayed, making it very easy to generate dynamic data. The AppWeb ESP architecture allows multiple scripting engines to be used at the same time. AppWeb is provided with server-side Embedded JavaScript which implements a subset of the ECMA-262 standard ECMAScript. Other scripting engines such as TCL, Perl or Python may also leverage this open scripting architecture in the future.

Embedded Server pages has a very small memory footprint (~45K including the JavaScript) and yet offeres powerful features like:

  • Expressions (variables, assignment, +, -, /, *, ++, --, <<, >> etc)
  • Variables (local and global)
  • Session variables
  • Control flow (if, else, while)
  • Control of redirection
  • Post back to the same page
  • Scripted generation and iteration of HTML text
  • Include Javascript libraries
  • Ability to call C/C++ procedures
  • Ability to access C/C++ variables


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 Embedded Server Pages for such systems.


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 ESP.


The Embedded Gateway Interface (EGI) was implemented by Mbedthis 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 ESP can do everything that EGI could be used for and so ESP or PHP 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 selective HTTP requests. This is useful if you have custom HTTP protocol extensions, proprietary authentication or authorization procedures or specific request timeout requirements.


In summary, We recommend using ESP for embedded applications and PHP for enterprise applications. The following table summarizes the differences between the various page creation alternatives.


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 10K
1-2MB Handler code
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 Allow any URL handling desired
Disadvantages Slow. Limit to forms. Can't design page WYSIWYG Limit to forms. Can't design page WYSIWYG Not quite the feature set of PHP
Large memory footprint Must build functionality
Use just for legacy CGI programs and scripts. Use ESP or PHP instead.
Use ESP instead.
Use where memory footprint matters. Useful in embedded systems.
Use where memory footprint is not a major concern. Useful for enterprise web applications.
Use for custom HTTP processing.

© Mbedthis Software LLC, 2003-2204. All rights reserved. Mbedthis is a trademark of Mbedthis Software LLC.