Wt Tutorial


Wt is a C++ library for developing interactive web applications.

Although C++ is not our first choice as a programming language when we talk about the websites and web applications. Mostly scripting languages like php, .net are associated with web development which is usually implemented at the level of generating responses for incoming requests.
But today web development is not limited to organization of various web pages only, a modern web application resembles more a desktop application. It is highly interactive, responsive and ultra fast.The browser is being transformed into a platform for applications where users interact with data and more often with each other.
To see an example how the web is changing day by day, you can view this chrome web store video.
So, Changes in how we use the web require a change in thinking about how we construct the web. So to construct a web like this, you should definitely try this amazing toolkit as it has various advantages over other web development tools, like

  • Abstraction of web implementation details – make easy to code and understand.
  • Interactive Web apps – easy to make high functionality and responsive web applications.
  • Security- security of website is inbuilt. No XSS and CSRF attacks.
  • Graceful degradation- graceful degradation is by default
  • Ultra-fast load time and low bandwidth usage

Wt Components

Widget
Widget is a basic building block of a web application that display an information arrangement changeable by the user.The user-interface, rendered in a browser window, is specified by creating and maintaining a widget tree.it just occupies a portion of a webpage and does something useful with information fetched from other websites and displayed in place. Other terms used to describe web widgets include: portlet, web part, gadget, badge, module.

Session Management
Session Management is entirely handled by the library itself.For every new session, which corresponds to a new user accessing your web application, the library creates a new WApplication object.Depending on the deployment model, the library will map sessions onto dedicated or shared processes.
Wt uses a keep-alive protocol between client and server to determine session lifetime. As long as the web page is displayed in the user’s browser, the session is kept alive. When the user closes his window, navigates away, or after a timeout when connectivity is lost, the session gets terminated. When a session is terminated, the application object together with the entire widget tree is deleted, therefore you should release resources held by your widgets or application in the destructors of these objects.

LETS START …. πŸ™‚

Step 1 : Installation

Follow Me

Step 2 : Examples

After installation, you will get a pile of examples @/usr/lib/Wt/examples in our file system. These examples help us a lot to make different and useful websites and web applications.

Step 3 : Basic Structure

Classes
Wt has a huge set of classes. Each having number of in built functions performing various useful tasks for web development.

Header files
Every time we use a class from Wt library in our program, we need to include its respective header file. Its syntax is same as in C++.
Here is one..

 #include <Wt/WApplication>

Wt::WApplication is first header file we need to include in our every Wt web development program.

Also you have different classes and their corresponding header files to be included for adding text, boxes, images, menus, title, Databases, Authentications, Forms, Models, Painting etc.
It’s an ocean with large number of valuable gems, deeper you go, more you get πŸ™‚


Let's have fun ...!! Work with fun :)