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 red 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 important, but what’s outside—what’s seen first—-is also 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 home page. 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 design custom tacos from a rich palette of ingredients.

2.1.1 Establishing the domain

2.1.2 Creating a controller class

2.1.3 Designing the view

2.2 Processing form submission

2.3 Validating form input

2.3.1 Declaring validation rules

2.3.2 Performing validation at form binding

2.3.3 Displaying validation errors

2.4 Working with view controllers

2.5 Choosing a view template library

2.5.1 Caching templates

Summary

sitemap