Wt: C++ Web Toolkit Library Lets You Write Scripting-Independent Web Apps
Wt (pronounced 'witty') is a C++ library and application server for developing and deploying web applications. Although Wt supplies a GUI, it is not your typical "framework", which locks you into someone's preconceived idea of how applications should be structured. Rather, Wt is widget-centric, and although inspired by existing C++ GUIs, it offers complete abstraction of any web-specific implementation details, all the way down to event handling and graphics support. It's probably not a coincidence that Wt is named similarly to the ever-popular Qt application development system!
Typical use scenarios:
- Web-based GUIs for embedded systems
- Web-based GUIs that require integration with (existing) C++ libraries
- 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.
- Built-in HTTPD and FastCGI for easy development and deployment.
- 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 with VML, SVG, or HTML 5.
- No exposure of business logic, which stays at the server.
- Page load time is limited only by screen complexity, not application size.
Installing Wt for Windows is a bit harder than implementing it on a Linux host, primarily because there isn't anything as simple as Linux package management on Windows. So, it becomes a bit of a scavenger hunt, although there is a nice how-to document. Basically, you are responsible for locating the suggested versions of BoostPro Boost library (currently, 1.34.1). BoostPro requires asio, the asynchronous I/O model for C++. This is theoretically included in BoostPro 1.35 although I didn't test it out. These components in turn require cmake, a freeware "make" type utility.
You'll start off with a "hello world" type app that provides a simple CGI type form and see how this design can be realized by a C++ app. Unlike most apps that I write about, you can actually run it for yourself right now on the web! What you'll see first is a classic web form presentation shown in Figure 1. After you enter your name and click the Submit button ("Greet me."), it rewrites the page and more-or-less you are back to the initial state, as shown in Figue 2.
Figure 1: Hello world forms (entering text)
Figure 2: Hello world forms (after clicking Submit)
Page 1 of 3