Chapter 2. Spring Roo on the Web

If you model your business data in the forest and nobody accesses it, did you really model it? In the last chapter, we looked at Spring Roo’s sophisticated support for easy data modeling, but this is not an end in of itself. To be useful, you need to connect your applications to your users, and the most obvious way to do this today is to build a web application that they can interface with. Spring Roo provides excellent support here, as well. Spring Roo supports many web technologies, including Spring MVC, Spring Webflow, Flex, GWT, Vaadin, and Flex.

We’ll review some of these technologies in this chapter.

Spring MVC

Spring MVC is a model-view-controller framework, which, as its name implies, has three essential parts. MVC is a well-known pattern in web frameworks. Its most redeeming quality is that it encourages clean, well-layered, decoupled applications that promote application growth to support new requirements. The “front controller” in the diagram is the Spring MVC DispatcherServlet, which needs to be registered in web.xml. It routes all requests coming into the web application to registered Spring MVC Controllers. Controllers are just POJO Spring beans that have annotations that describe the mapping between a URL (and the HTTP method—GET, PUT, POST, DELETE, etc.—used to access that URL) and the methods in a controller.

The interaction between the model, the view, and the controller

Figure 2-1. The ...

Get Getting Started with Roo now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.