Spring Start Here cover
welcome to this free extract from
an online version of the Manning book.
to read more
or

8 Implementing web apps with Spring Boot and Spring MVC

 

This chapter covers

  • Using a template engine to implement dynamic views
  • Sending data from client to server through HTTP requests
  • Using GET and POST HTTP methods for your HTTP requests

In chapter 7, we made progress in understanding how to use Spring to write web apps. We’ve discussed a web app’s components, the dependencies a web app needs, and the Spring MVC architecture. We even wrote a first web app to prove all these components work together.

In this chapter, we’ll take a step further and implement some capabilities you’ll find in any modern web app. We’ll start with implementing pages whose content changes according to how your app processes the data for specific requests. Today we rarely see static pages on websites. You probably think already: “There has to be a way to decide what content to add on the pages before delivering the HTTP response back to the browser.” And there are ways in which you can do this!

In section 8.1, we’ll implement dynamic views using template engines. A template engine is a dependency that allows you to easily get and display in the view variable data that the controller sends. We’ll demonstrate how the template engine works in an example after reviewing the Spring MVC flow.

8.1      Implementing web apps with a dynamic view

8.1.1   Getting data on the HTTP request

8.1.2   Using request parameters to send data from client to server

8.1.3   Using path variables to send data from client to server

8.2      Using the GET and POST HTTP methods

8.3      Summary

sitemap