Last updated February 10, 2009 22:11, by Nick Sieger
Feedicon  

Introduction


Webem is a web server that you can embed in your C++ application. It makes it easy to implement a browser GUI accessible from anywhere.

Webem is based on a minimally modified version of the boost::asio web server, and uses a simple way of allowing html code to execute C++ methods.

Background


The available embedded C++ web servers are a challenge to use, and tend not to be Windows friendly. They are not the kind of thing you want to get into just to add the ability to monitor your lab application from your cell phone.

I have tried Wt but was defeated by the installation and learning curve.

I recently began using Webio by John Bartas . I liked the concept and it worked well.

However, I still found Webio overly complicated to use and the server code hard to understand. I wanted something easier to use, based on a well known web server that had only been slightly modified.

A lot of the complexity of Webio is caused by using an “HML compiler” to hide the HTML pages that control the appearance of the GUI inside a file system embedded inside the application code. I prefer to have the HTML pages outside in plain view where I can adjust the GUI without recompiling the application.

I learned a lot trying to adjust Webio to my taste, and eventually was ready to build my own exactly to my requirements.

Using the Code


You build your application's GUI exactly like you build a web site - create pages using HTML all starting from index.html.

Now you need to make the HTML invoke your C++ methods. There are three things you can do:

  • Create include methods which webem invokes to generates HTML text included in the web page
  • Create action methods which webem invokes when the user clicks on buttons in the web page
  • Use "webem controls", classes which combine include methods and action methods to display and update your application data.

Example Applications


  • "Hello World" uses an include method to display data from an application on a web page.
  • "Formal Hello" combines include and action methods to create a simple web application.
  • "Calendar" uses a control to display and update a database table.
  • "Month" uses a control to display date data with one month per page.

Webem Controls


  • cWebemTable displays and deletes records from a SQLITE database table
  • cWebemMonth displays application data which is associated with dates, month by month
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close