Java Reference
In-Depth Information
Figure 3-6. View management class diagram
The ViewResolver interface defines a single method, resolveViewName , which tries
to resolve a view by name. This method also takes a Locale object as an argument,
which allows implementing classes to support internationalized view lookup. The
BeanNameViewResolver class resolves a view by looking up the current application context
for a bean that has the same name as the view name. AbstractCachingViewResolver pro-
vides a convenience base class to implement view resolvers. It caches view objects once
resolved. Like many other classes in the Spring Framework, this class implements the
template pattern, and subclasses implement the abstract method loadView .
The ResourceBundleViewResolver and XmlViewResolver use resource bundles and XML
files to load view definitions. However, this is not the only difference, as I will show you
in the examples later in this chapter. UrlBasedViewResolver is useful because it converts
view names to URLs, without any mapping definition being required explicitly. It can
optionally use a prefix and a suffix. So, a view name of claimdetail and suffix of . jsp will
result in the URL claimdetail.jsp . In short, this class helps map a logical view name to a
physical resource. JasperReportsViewResolver works specifically to map a view name to
 
Search WWH ::




Custom Search