Introduction: This tutorial is the last part of a series of six sections, showing you how to use the Spring framework to Java™server Page (JSP), Velocity, Tile, and PDF export capabilities. You will experiment with V in Model-view-controller (MVC), the various Web views built into Spring MVC. With a comprehensive introduction to the various view technologies supported by Spring MVC, you will see how easy it is to implement these techniques in the sample telephony application that was built throughout the series of tutorials.
Before you start
This series of tutorials is appropriate for more information about the spring framework and how to use the powerful Java Platform, Enterprise Edition (Java EE) developer who uses the spring Framework on the Apache Geronimo application server.
About this series of tutorials
This series of tutorials is divided into 6 sections that show you how the spring framework and the spring framework are used in conjunction with Geronimo. We will start by examining the various Spring framework methods and how they are used in conjunction with the Geronimo server. Throughout the series, you will develop and deploy personal telephony applications. The application includes the following features:
Show Phone Book
Show details for each entry
Add a new entry to the phone book
Edit, modify, and delete entries
Add more details to the entry, such as the primary e-mail address
Part 1th describes the various modules of the Spring framework and describes the relationship between each module and the development of Java EE applications on the Geronimo application server. This section also explains the approach that the Spring framework is based on.
Part 2nd describes how to use the Spring framework to build the first skeleton system application on Geronimo.
In part 3rd, you will use the Apache Derby database to add Java database connection (JDBC) support to extend the Geronimo application obtained in part 2nd. You will also learn how to integrate object-relational mapping (ORM) into applications that use IBatis.
In the 4th part, you will face the spring AOP and Spring WEB framework. With spring AOP, any object managed by the spring framework can become aspect-oriented, and this tutorial takes advantage of declarative transaction management services provided through Spring AOP.
The 5th part describes Spring MVC. This tutorial introduces you to the MVC framework and Web view, which gives you an idea of how to get started with Spring MVC.
In the last installment, the 6th part, how to use the JSP, Velocity, Tile, and PDF export capabilities through the Spring framework. You will use and experience the various Web views built into Spring MVC.
About this tutorial
As noted above, part 5th of this series of tutorials provides a complete introduction to the Spring MVC module. You learned about C in the various controller--MVC provided by Spring MVC. This tutorial examines the V in various view technology--MVC.
One of the biggest challenges for WEB application developers is to create adaptable designs. Making the view component flexible is very challenging. Because Spring's support for view is robust, this challenge is easier to manage. The purpose of using the JSP, Tile, Velocity, and PDF export features in this tutorial is to demonstrate how the Spring MVC API makes this possible.
JSP and Velocity are two complementary view technologies. You can create a view with any technology, each with its own pros and cons. This tutorial demonstrates how simple it is to use one of these techniques to replace another technology in a sample telephony application.
First we'll look at JSP support in Spring MVC, and then look at Tile, a good template engine for view layout management. Tile makes it easy for you to manage Web page layouts, and Spring has built-in support for Tile. You will use these classes to change the Web layout of the Telephony application.
Next, you will replace the use of the JSP by using a view defined by the Velocity template engine. Velocity allows you to easily access Java objects in a view without the need for complex definitions and Java constructs, such as a Try Catch loop.
Finally, you'll see how to adjust the home page of the phone's application to display as a PDF file. Spring will handle all the hassle and complexity of the code and logic needed to create a PDF. It provides you with a clean API to handle content without confusing the details of the PDF.