Expert Spring MVC and Web Flow
If you’re developing console applications, your user interface might consist of a menu of options keyed by letter or number. For ...
Listing 7-1.View Interface Definition public interface View { void render(Map model, HttpServletRequest request, HttpServletResp ...
For now, we’ll have a quick tour of some of the common supporting functionality that Spring implements and how it applies to the ...
The preceding diagram shows that all of the Spring Viewimplementations extend AbstractViewand that the majority also descend fro ...
By default, this will have the value text/html; charset=ISO-8859-1, and this is appropri- ate for any view rendering HTML with a ...
Once you have added your static attributes to the Viewinstance, they are merged with the dynamic attributes and simply become pa ...
still at liberty to change the JSP—or even the implementation of InternalResourceView without reference to any of the Controller ...
Listing 7-8.The ViewResolver Interface public interface ViewResolver { View resolveViewName(String viewName, Locale locale) thro ...
Types of ViewResolver ViewResolveris a strategy interface within the framework. In order to get a better handle on how view reso ...
ResourceBundleViewResolveruses view bean definitions in a ResourceBundlein the class- path. By default the base name for this b ...
PARENT AND ABSTRACT BEANS We’re declaring a parent view under the name parent-view. This isn’t used as an actual view in our app ...
value="/WEB-INF/jsp/home.jsp"/> </bean> Making ViewResolvers Known to the Dispatcher You can define any number of V ...
can be prioritized if they implement the Orderedinterface and this is what some of the con- crete ViewResolvers do. Set the orde ...
A Word on Redirecting ■NoteThis section is naturally about views, but we’ve left it until after the discussion on ViewResolvers ...
You can, of course, simply have your Controllercreate a new RedirectViewas part of the ModelAndViewthat it returns, but as we’ve ...
href="<spring:theme code="style"/>" type="text/css"/> </head> <body background="<spring:theme code="backgro ...
ThemeResolvers The ThemeResolverdoes a very similar job to that of its colleagues, LocaleResolverand ViewResolver. It returns th ...
Table 7-2.LocaleResolver Implementations Implementation Description FixedLocaleResolver Always returns the same locale for each ...
Listing 7-19.MessageSource Bean Definition <bean id="messageSource" class="org.springframework.context.support.ResourceBundle ...
Theme Resolution In very similar style to the ResourceBundleViewResolverexplained in the preceding section, the ResourceBundleTh ...
«
7
8
9
10
11
12
13
14
15
16
»
Free download pdf