Tntnet is a web server which allows users to develop web applications using C++. It has a template language ecpp where C++ code can be embedded into html similar to php or jsp. The pages are compiled and linked into a shared library. The result is a native web application which is compact and fast.


This example shows a little web form and processes the input of that by adding or subtracting a value to a session variable.

// define variables which are filled from the form

double value = 0;  // default value is 0
bool add;
bool sub;
// define a session variable of type double with a initial value of 0
double currentValue = 0;

  if (add)
    currentValue += value;
  if (sub)
    currentValue -= value;

<!DOCTYPE html>
  <title>Tntnet accumulator</title>
  <# this prints the session variable into the screen
     (and btw: this is a comment) #>
  The current value is <$ currentValue $>.
  <form method='post'>
   <input type='number' name='value' value='<$ value $>'><br>

   <input type='submit' name='add' value='add value'>
   <input type='submit' name='sub' value='subtract value'><br>


Further reading

To learn more about Tntnet read the Tntnet man pages