liveBook · Manning

Dynamic view

As explained in Spring Start Here, Second Edition

A dynamic view is a presentation resource whose rendered content is generated or populated from runtime application data.

A dynamic view displays variable content supplied by a controller. A template engine lets the view incorporate that data into the response sent to the browser. section 8.0 section 8.4

A cart that changes

An online shop can use the same cart page for different requests: the controller sends the current product list, and the view displays it. section 8.1

Figure 8.1 A dynamic view presented with the Manning shopping cart functionality. Even if the requested page is the same, the content of the page is different. The backend sent different data in the HTTP response before and after adding one more product to the cart.

Compare the cart page before and after a product is added to see how different response data changes the same view. section 8.1

How Spring Start Here, Second Edition covers it

How deep it goes
Demonstrates controller-to-view data flow and a Thymeleaf example using model attributes and template expressions.
Examples
Uses a shopping cart with changing products and a home page populated with a username and color.
What you can do after
Build a dynamic Spring page by passing controller model attributes into a Thymeleaf template.
How it connects
Connects dynamic views to Spring MVC controllers, template engines, Thymeleaf, and HTTP requests.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.