Expert Spring MVC and Web Flow

(Dana P.) #1

Figure 8-1.Flight departures output


JSP Tag Libraries


Spring provides a set of JSP tag libraries for use in your applications. There are tags for simplify-
ing form handling, retrieving internationalized messages from one or more resource bundles (in
conjunction with Spring’s Locale resolution support), and a few others. Table 8-1 has a summary
of what’s available.


Table 8-1.Summary of Spring’s JSP Tags


Tag Name Description


spring:bind Used in HTML forms, the tag exposes a status attribute to the
JSP containing information about the command object (or a field on
the command object) that it has been bound to. The status attribute
holds the name of the field, its present value, if any, and any validation
errors associated with that field.


spring:hasBindErrors Determines whether a field, or command object that has been bound
to with the tag currently has any validation errors.


spring:nestedPath Exposes a prefix path that can be used to simplify subsequent usage of
the tag.


spring:transform Allows a non–command object property to be transformed with
PropertyEditors in the same way that bound fields can be. This tag
can onlybe used inside a tag.


spring:message Retrieves localized messages from a MessageSource. Functionally
similar to JSTL’s tag, but works with Spring’s
ApplicationContextand locale support.


spring:htmlEscape Used to specify a page-level default for HTML escaping. Tags that might
emit content containing characters that need to be converted to HTML
entities will be affected by this tag.


spring:escapeBody Custom tag that can be used to escape the content of its own body for
HTML, JavaScript, or both.


spring:theme Look up a value from a theme definition file based on the key supplied
to the tag as a parameter. This tag was discussed in the previous
chapter in the section on themes.


CHAPTER 8 ■SUPPORTED VIEW TYPES 227
Free download pdf