Expert Spring MVC and Web Flow

(Dana P.) #1

■Tip Using the convenience tags for form elements (available for JSP, Velocity, and FreeMarker) can hide
much of the usage of the Spring tags. Chapters 7 and 8 have more details.


Summary


We will cover these tags in much more detail in Chapter 7, so don’t worry if you don’t see the
payoff right away. For now, the take away from this section is this: the tag pro-
vides a way to expose the property of a command bean to the form, as well as metadata about
the property such as errors, full path name, and the current value. When working with valida-
tors, this tag provides an easy way to integrate with any potential errors. Because most forms
use validation in one form or another, we recommend the use of these tags, even if validation
isn’t currently enabled.


Success View


When a SimpleFormControllersuccessfully completes its processing of a form submission,
the success view will render the results. The success view for this use case will iterate through
the search results to display them to the user, as shown in Listing 4-20.


Listing 4-20.Success View XHTML JSP


<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">





List Flights


List Flights



You searched for flights leaving ${searchFlights.departFrom} on or about
${searchFlights.departOn}, heading to ${searchFlights.arriveAt}, returning on
or about ${searchFlights.returnOn}.








CHAPTER 4 ■JUMP INTO SPRING MVC 73
Number of Legs Total Travel Time Total Cost