Wt (web toolkit)


Wt is an open-source widget-centric web framework for the C++ programming language. It has an API resembling that of Qt framework, also using a widget-tree and an event-driven signal/slot system.
The Wt's design goal is to benefit from the stateful component model used in desktop-applications APIs, applied to web development—instead of the traditional MVC design pattern. So rather than using MVC at the level of a web page, it is pushed to the level of individual components.
While the library uses a desktop software development process, it does support some web-specific features, including:
One of the unique features of Wt is its abstraction layer of the browser rendering model. The library uses Ajax for communicating with browsers compatible with it, while using plain HTML-form post-backs for other user agents. Using a progressive bootstrap-method, the user interface is rendered as a plain HTML document first, then, provided its support in browser, it is automatically upgraded to use Ajax for increased interactivity. In this way, Wt is by definition:
Because of the popularity of C/C++ in embedded system environments, Wt is often used in such devices and has been highly optimized for performance.

Major features

For a more detailed overview, see the Features section of official website.

Code example

The "Hello, World!" program in Wt:

  1. include
  2. include
  3. include
  4. include
  5. include
  6. include
/*
* A simple hello world application class which demonstrates how to react
* to events, read input, and give feed-back.
*/
class HelloApplication : public Wt::WApplication
/*
* The env argument contains information about the new session, and
* the initial request. It must be passed to the WApplication
* constructor so it is typically also an argument for your custom
* application constructor.
  • /
HelloApplication::HelloApplication
: WApplication
void HelloApplication::greet
int main