<bean id="freemarkerResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
■CautionThe prefix property on the ViewResolveris relative to the resourceLoaderPath.When set-
ting the resourceLoaderPathto WEB-INF/velocity,as we did earlier, we then needed to ensure that the
ViewResolverprefix was empty. This differs a little from the way InternalResourceViewResolveris
usually configured for JSPs.
As you’ll remember from the discussions on InternalResourceViewResolver, your
Controllers need only specify the Viewkey—in this case home—and the resolver will do
the rest. With Velocity, for example, the resolver looks in the specified template directory
(WEB-INF/velocity, which we set on the VelocityConfigurerbean) for a file with a prefix of "",
a name of home, and a suffix of .vm. In other words, WEB-INF/velocity/home.vm.
In the simplest cases you need do no more. Your templates are placed in WEB-INF/velocity,
and you’ve defined the engine configuration and ViewResolverbeans that form the basis of
Spring’s integration for these template languages. For the sample application home page this is
fine. Figure 8-3 shows the file system layout.
Figure 8-3.WEB-INF directory with several view layers and the libraries required
CHAPTER 8 ■SUPPORTED VIEW TYPES 237