Chapter 2. Developing web applications


This chapter covers

  • Presenting model data in the browser
  • Processing and validating form input
  • Choosing a view template library

First impressions are important. Curb appeal can sell a house long before the home buyer enters the door. A car’s cherry paint job will turn more heads than what’s under the hood. And literature is replete with stories of love at first sight. What’s inside is very important, but what’s outside—what’s seen first—is important.

The applications you’ll build with Spring will do all kinds of things, including crunching data, reading information from a database, and interacting with other applications. But the first impression your application users will get comes from the user interface. And in many applications, that UI is a web application presented in a browser.

In chapter 1, you created your first Spring MVC controller to display your application homepage. But Spring MVC can do far more than simply display static content. In this chapter, you’ll develop the first major bit of functionality in your Taco Cloud application—the ability to design custom tacos. In doing so, you’ll dig deeper into Spring MVC, and you’ll see how to display model data and process form input.

2.1. Displaying information

Fundamentally, Taco Cloud is a place where you can order tacos online. But more than that, Taco Cloud wants to enable its customers to express their creative side and to design custom tacos from a rich palette of ingredients.

2.2. Processing form submission

2.3. Validating form input

2.4. Working with view controllers

2.5. Choosing a view template library