Sie sind auf Seite 1von 1

The Spring series, Part 3: Swing into Spring MVC Sunny day application development with Spring MVC

Level: Intermediate Document options Print this page E-mail this page Discuss Sample code developerWorks comes to you! Export content to your iGoogle page and desktop Rate this page Help us improve this content Naveen Balani (mailto:naveenb@webifysolutions.com?subject=Swing into Spring MVC&cc=htc@us.ibm.com), Technical Architect, Webify Solutions 06 Sep 2005 Learn how to develop MVC-based applications using the Spring framework, in this third installment of Naveen Balani's popular Spring series. In this third installment of the Spring series, I introduce you to the Spring Model-View-Controller (MVC) framework. As in the previous articles, I use a banking example to show you how to model and build a simple application. The example application will encompass some of the techniques you've already learned -- such as dependency injection -- but will primarily demonstrate features of Spring MVC. Download the article source before you begin. See Resources to access the Spring framework and Tomcat 5.0, which you will need to run the examples. The Spring MVC framework The Spring framework provides a full-featured MVC module for building Web applications. With Spring's pluggable MVC architecture, you can choose whether you want to use the built-in Spring Web framework or a Web framework such as Struts. The framework is highly configurable through strategy interfaces and accommodates multiple view technologies such as JavaServer Pages (JSP) technology, Velocity, Tiles, iText, and POI. The Spring MVC framework is view agnostic, so does not push you to use only JSP technology. Spring MVC separates the roles of the controller, the model object, the dispatcher, and the handler object, which makes them easier to customize. Spring's Web MVC framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale, and theme resolution as well as support for upload files. The default handler is a very simple Controller interface with just one method, ModelAndView handleRequest(request, response). Spring provides a controller hierarchy that can be subclassed. If your application needs to process user entry forms you might subclass AbstractFormController. If you need to process a multi-page entry into a single form you can subclass AbstractWizardFormController. An example application will help you learn about these features first hand. The banking application will allow users to retrieve their account information. In the process of building it, you'll learn how to configure the Spring MVC framework and implement the framework's view layer, which will consist of JavaServer Pages technology with JSTL tags for rendering the output data.

Das könnte Ihnen auch gefallen