example, JSP, Velocity, and so on). In addition, Spring MVC integrates with many common web
frameworks and toolkits (for example, Struts, Adobe Flex, GWT, and so on). Other Spring projects help
address specific needs for web applications. For example, Spring MVC, when combined with the Spring
Web Flow project and its Spring Faces module, provides comprehensive support for developing web
applications with complex flows and using JSF as the view technology. Simply speaking, there are so
many choices out there in terms of presentation layer development.
This chapter will focus on Spring MVC and will discuss how we can use the powerful features
provided by Spring MVC to develop highly performing web applications. Specifically, this chapter will
cover the following topics:
Spring MVC: We will discuss the main concepts of the MVC pattern and introduce
·
Spring MVC. For Spring MVC, we will go through its core concepts, including its
WebApplicationContext hierarchy and the request-handling life cycle.
i18n, locale, and theming: Spring MVC provides comprehensive support for
·
common web application requirements including i18n (internationalization),
locale, and theming. We will discuss how to use Spring MVC to develop web
applications that support those requirements.
View and Ajax support: Spring MVC supports many view technologies. In this
·
chapter, we will focus on using JavaServer Pages (JSP) as the view part of the web
application. On top of JSP, JavaScript will be used to provide the richness part.
There are many outstanding and popular JavaScript libraries such as jQuery, Dojo,
and so on. In this chapter, we will focus on using jQuery, with its subproject
jQuery UI library that supports the development of highly interactive web
applications.
Pagination and file upload support: When developing the samples in this chapter,
·
we will discuss how we can use Spring Data JPA and the frontend jQuery
component to provide pagination support when browsing grid-based data. In
addition, how to implement file upload in Spring MVC will be covered. Instead of
integration with Apache Commons File Upload, we will discuss how we can use
Spring MVC with the Servlet 3.0 container's built-in multipart support for file
upload.
Security: Security is a big topic in web applications. We will discuss how we can
·
use Spring Security to help protect the application and handle logins and logouts.
Spring MVC and the sample application: Many topics discussed in this chapter
·
will be used in developing the sample application for this topic. We will give a
high- level overview of the relationship between the topics in this chapter and the
sample application.
Create Project in STS for Samples
As usual, the first step is to create the project for the samples in this chapter. Because we are discussing
web applications, we need to create a Spring MVC project. In addition, we will create a service layer
using JPA 2 with Hibernate and Spring Data JPA as the persistence service provider. To create the project
in STS, please refer to Chapter 16, which also details the required dependencies. Make sure to change
the project name and all package names to use "ch17" instead of "ch16" for this chapter. After you have
created the project, verify that you can see the default home page created by the template project, which
indicates that the initial project works correctly.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home