Chapter 13. Web View Technologies

In the previous chapter you learned how to use Spring's Web MVC Framework. We explored how to implement controllers, how to create models, and how to map incoming requests to relevant controllers. This chapter will show you how to render views based on the models your controllers return.

We reviewed the requirements for a well-designed MVC package. One of the most important is that the controller infrastructure should be view-agnostic. You've seen how Spring achieves this by using logical view names in combination with components called view resolvers.

This chapter explores the view resolvers that Spring provides. Each one of them offers a unique way to transform logical view names to resources capable of rendering the view itself (such as a JSP or Velocity template). It's also possible to implement custom view resolves for additional view technologies.

First, we will introduce some of the basic concepts through an example. Then we will explain some of the view technologies Spring integrates with, such as JavaServer Pages, Velocity, and iText PDF. We'll also cover the features included to simplify the creation of HTML forms. You can use this functionality when writing JSPs and FreeMarker and Velocity templates.

After working through this chapter, you will know how to use the view technologies integrated with Spring to create a flexible, maintainable user interface for your web applications, not only using HTML-based views, but also variations such as ...

Get Professional Java™ Development with the Spring Framework now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.