In this chapter, we've reviewed some of Spring's integration facilities you can use when developing the front-end of a web application using Spring MVC. One of the important things to keep in mind when developing an application that might, in the future, require more than just one view technology is to design your controllers in such a way that they don't include any view-dependent elements. Tie your views to your controller using the logical view name only, available in the ModelAndView class. View resolvers will determine what view will be used to render the model returned from the controller. This separation allows for application including several view technologies.

We've also seen why Spring chose a model implementation that has been completely decoupled from the HttpServletRequest: to allow seamless integration of view technologies such as the document- based PDF and Excel views that are not aware of the Servlet API. This clean decoupling of model and controller from view is one of the key strengths of Spring MVC.

The last thing we've reviewed is how to implement your own view. Although you will hardly ever need this (Spring integrated with numerous view technologies out-of-the-box), it's good to know that it's possible.

The next chapter will focus on integrating other MVC and web-oriented frameworks with Spring, such as Struts, WebWork, Tapestry, and JSF. Spring MVC is a flexible and lightweight solution for building request-driven web applications, but in some situations, there might be an existing investment in another web framework such as Struts. Sometimes it's better to be pragmatic about what solution to use. Leaving your front-end alone and refactoring your backend infrastructure to use Spring is a perfect way to start modernizing your application.

Professional Java Development with the Spring Framework
Professional Java Development with the Spring Framework
ISBN: 0764574833
EAN: 2147483647
Year: 2003
Pages: 188 © 2008-2017.
If you may any questions please contact us: