liveBook · Manning

Dynamic content

As explained in Rust Servers, Services, and Apps

A dynamic web page is a web document whose content is generated or changed in response to request data, application state, or other runtime inputs.

A dynamic web page combines shared static elements with content generated from runtime data. In server-side rendering, a template engine inserts application data into a template and returns HTML to the browser. section 7.1 section 7.3

An Actix Web and Tera request follows this path:

  • Create a Tera context and insert values such as a user's name. section 7.3
  • Render the template with that context, then return the result as an HTML response. section 7.3

Personalized bank greeting

A shared bank template contains {{ name }}; inserting “Bob” produces “Welcome Bob, to XYZ bank home page!” The page can retain common styling while displaying user-specific content. section 7.3 section 7.1

<!DOCTYPE html>
<html>
 
<head>
    <title>XYZ Bank Website</title>
</head>
 
<body>
  <h1>Welcome {{ name }}, to XYZ bank home page!</h1>
  <p>This is an example of a dynamic web page served with Actix and
  Tera templates.</p>
</body>
</html>

Inspect the Tera HTML template and its name placeholder. section 7.3

How Rust Servers, Services, and Apps covers it

How deep it goes
Defines static and dynamic pages and walks through an Actix/Tera handler, while leaving broader template features for exploration.
Examples
Contrasts a shared bank homepage with personalized account pages and renders a greeting for Bob.
What you can do after
Build it from scratch: render HTML with Actix and Tera by inserting data into a template context.
How it connects
Connects server-side rendering with template engines, user data, cookies, and authentication.

Also explained in

Compare how 2 books explain dynamic content →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.