Skip to main content
main-content

Über dieses Buch

Pro Spring MVC provides in-depth coverage of Spring MVC and Spring Web Flow, two highly customizable and powerful web frameworks brought to you by the developers and community of the Spring Framework.

Spring MVC is a modern web application framework built upon the Spring Framework, and Spring Web Flow is a project that complements Spring MVC for building reusable web controller modules that encapsulate rich page navigation rules. Along with detailed analysis of the code and functionality, plus the first published coverage of Spring Web Flow 2.x, this book includes numerous tips and tricks to help you get the most out of Spring MVC, Spring Web Flow, and web development in general.

Spring MVC and Spring Web Flow have been upgraded in the new Spring Framework 3.1 and are engineered with important considerations for design patterns and expert object-oriented programming techniques. This book explains not only the design decisions of the frameworks, but also how you can apply similar designs and techniques to your own code.

This book takes great care in covering every inch of Spring MVC and Spring Web Flow to give you the complete picture. Along with all the best known features of these frameworks, you’ll discover some new hidden treasures. You’ll also learn how to correctly and safely extend the frameworks to create customized solutions. This book is for anyone who wishes to write robust, modern, and useful web applications with the Spring Framework.

Inhaltsverzeichnis

Frontmatter

Chapter 1. Configuring a Spring Development Environment

Abstract
Before you can really start your journey into Spring MVC, you need to make sure you have your development environment set up right. This chapter will begin by walking you through that process. Next, it will provide some details about the sample bookstore application that ships with this book. But before going into either the details of the development environment or the sample application, this chapter will provide an overview of the prerequisites for your environment in general.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 2. Spring Framework Fundamentals

Abstract
The Spring Framework evolved from the code written for Expert One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002). The framework combines best practices for Java Enterprise Edition (JEE) development from the industry and integration with the best-of-breed third-party frameworks. It also provides easy extension points to write your own integration if you need one that doesn't yet exist. The framework was designed with developer productivity in mind, and it makes it easier to work with the existing, sometimes cumbersome Java and JEE APIs.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 3. Web Application Architecture

Abstract
Before we start our journey into the internals of Spring MVC, we first need to understand the different layers of a web application. And we'll begin that discussion with a brief introduction of the MVC pattern in general, including what it is and why should we use it. We will also cover some of the interfaces and classes provided by the Spring Framework to express the different parts of the MVC pattern.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 4. Spring MVC Architecture

Abstract
In this chapter, you will dive into the internals of Spring MVC, taking a close look at the org.springframework.web.servlet.DispatcherServlet. You will begin by learning how an incoming request is handled by the servlet, as well as how to identify which components play a role in the request handling. After these components have been identified, you will go deeper into the roles and functions of the different components and the different implementations of those components. You will also learn how to configure the org.springframework.web.servlet.DispatcherServlet, in part by examining the default configuration.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 5. Implementing Controllers

Abstract
Controllers play a crucial role in a web application: they execute the actual request, prepare the model, and select a view to render. In conjunction with the dispatcher servlet, controllers also play a crucial role in the request processing workflow. The controller is the glue between the core application and the web interface to the application. In this chapter, we will take a look at the two different controller approaches and cover the out-of-the-box implementations provided with the Spring Framework.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 6. Implementing Controllers — Advanced

Abstract
In this chapter, we are going to take a look at some of the more advanced parts of Spring MVC, and then see how we can tap into the framework itself to extend it to suit our needs.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 7. REST and AJAX

Abstract
Until now we have been building quite a classic web application: we send a request to the server, the server processes the request, and we render the result and show it to the client. Over the last decade, however the way we build web applications has changed considerably. Now we have JavaScript and JSON/XML, which allow for AJAX-based web applications and also push more and more behavior push to the client, including validation, rendering parts of the screen, and so on.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 8. Resolving and Implementing Views

Abstract
So far we have mainly used Java Server Pages (JSP) as our view technology; however, Spring MVC provides a very powerful and flexible mechanism to resolve and implement views. We looked briefly at the view resolving mechanism in Chapter 4; in this chapter we will take a closer look at the different ViewResolver implementations and see how we can create and use our own implementation.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 9. Testing Spring MVC Applications

Abstract
Testing is in most projects a bit of a struggle point. We all know testing is important, but we also know that testing takes time and writing good tests is difficult. Testing also requires adequate infrastructure in your code base.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 10. Spring Web Flow

Abstract
Spring Web Flow 2 (which we will call Web Flow from now on) is an important piece of the puzzle when it comes down to building scalable, easy-to-develop-and-maintain web applications. In the upcoming three chapters, we will make you familiar with Web Flow and its strengths and weaknesses; we will also cover why, when, and, above all, how you should use it. In this chapter, we start off explaining what Web Flow is and what it can do for you. Later on, we will discuss some basic Web Flow elements that you need to understand before you can start building your first flow.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 11. Building Applications with Spring Web Flow

Abstract
In the previous chapter on Spring Web Flow, we introduced you to Web Flow’s main features and what it can do for you. We also covered what a basic Web Flow configuration looks like and how it can be integrated with Spring MVC. We saw some basic elements that are part of almost every flow, such as the view state and the evaluate action. And we ended by converting our Bookstore to a basic Web Flowenabled application.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 12. Advanced Spring Web Flow

Abstract
Welcome to the final chapter on Spring Web Flow. In the couple previous chapters, we made you familiar with the Web Flow basics, such as how to configure Web Flow, glue it together with Spring MVC, and set up a basic flow. We also explained the different elements, such as action states, model binding, validation, application controllers (and how to call them), expressions, and so forth.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Chapter 13. Spring Security

Abstract
As we all know, security is important for any application. This is especially true for web applications, which are exposed to the Internet. Exposure to outside threats is obvious, and dealing with it will be a major part of your effort to develop secure solutions. However, the challenges that confront a developer are not only external threats.
Marten Deinum, Koen Serneels, Colin Yates, Seth Ladd, Christophe Vanfleteren

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise