Wt: an introduction

Wt (pronounced 'witty') is a C++ library and application server for developing and deploying web applications. It is not a 'framework', which enforces a way of programming, but a library.

The API is widget-centric, and inspired by existing C++ Graphical User Interface (GUI) APIs. To the developer, it offers complete abstraction of any web-specific implementation details, including event handling and graphics support.

Page-based frameworks (such as based on PHP or JSP/JSF (+ servlets + struts)) for developing web application do not make abstraction of the peculiarities of the underlying technologies (HTML/XHTML, JavaScript, CSS, AJAX, Forms, DHTML, SVG/VML/Canvas). As a consequence, a developer must gain familiarity with all of these (evolving) technologies. Moreover, when choosing to use a technology (such the currently popular AJAX), the developer is responsible for graceful degradation when AJAX or JavaScript are not available or disabled. The structure of the application follows mostly the page-centric paradigm of early day HTML. This means that when using advanced AJAX techniques, as a developer you will need to design and maintain manually your client-server communication.

Generating HTML code or filling HTML templates is prone to security problems such as XSS (Cross-Site-Scripting), by unwillingly allowing JavaScript to be inserted in the page. But this cannot be avoided by template frameworks, because as a developer you need to be able to insert self-written JavaScript to improve your web application.

In contrast, a web application developed with Wt is written in only one compiled language (C++), from which the library generates the necessary HTML/XHTML, Javascript, CGI, SVG/VML/Canvas and AJAX code. The responsibility of writing secure and browser-portable web applications is handled by Wt. For example, if available, Wt will maximally use JavaScript and AJAX, but applications developed using Wt will also function correctly when AJAX is not available, or when JavaScript is disabled, reverting to a plain HTML/CGI mechanism for communication between browser and server.

Typical use scenarios:

  • Web-based GUIs for web-enabled embedded systems benefit from the low footprint of a C++ web application server.
  • Web-based GUIs that require integration with (existing) C++ libraries, for example for scientific or engineering applications.
  • Creating a port of existing C++ desktop applications to the web.

Some benefits of using Wt

  • Develop web applications like you develop C++ desktop applications.
  • Provides plain widgets, which work regardless of JavaScript availability (but benefit from JavaScript availability), and Wt::Ext widgets which are more polished, or provide advanced functionality, but require JavaScript and a modern browser. As far as possible, these widgets share the same API.
  • Use the built-in httpd for easy development and deployment, or use the FastCGI connector to deploy as a FastCGI application.
  • A single specification for both client- and server-side validation and event handling (when using stateless slot implementations)
  • Generates standards compliant HTML or XHTML code.
  • Portable, anti-aliased graphics (uses inline VML, inline SVG or the HTML 5 canvas).
  • No XSS security risks since Wt has complete control over the presentation layer and proactively filters out active tags and attributes. No exposure of business logic, which stays at the server.
  • Ultra-fast load time and low bandwidth usage, which are affected only by screen complexity, not application size.