Book description
Your ultimate guide to building a complete web application using all the capabilities of Spring MVC
In Detail
The MVC architecture for developing web applications continues to be a powerful concept and the most popular design pattern known by developers. Spring MVC is a model-view-controller framework for Java web applications to simplify the writing and testing of Java web applications, which fully integrates with the Spring dependency injection framework. With the power of annotation-based configuration, Spring MVC makes web application development easy for developers.
This book is a great companion for beginners who want to learn Spring MVC. With the help of real-world examples, you will learn how to create a completely functional web application. You will also get a complete overview of the Spring web development environment and all its key components.
What You Will Learn
- Familiarize yourself with the anatomy of the Spring development environment
- Learn about the web application architecture and Spring MVC request flow
- Integrate bean validation and custom validation
- Use error handling and exception resolving
- Discover REST-based web service development and Ajax
- Test your web application
- Learn how to use Tiles and Web Flow frameworks in your MVC application
Table of contents
-
Spring MVC Beginner's Guide
- Table of Contents
- Spring MVC Beginner's Guide
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
-
1. Configuring a Spring Development Environment
- Setting up Java
- Time for action – installing JDK
- Time for action – setting up environment variables
- Configuring a build tool
- Time for action – installing the Maven build tool
- Installing a web server
- Time for action – installing the Tomcat web server
- Configuring a development environment
- Time for action – installing Spring Tool Suite
- Time for action – configuring Tomcat on STS
- Time for action – configuring Maven on STS
- Creating our first Spring MVC project
- Time for action – creating a Spring MVC project in STS
- Time for action – adding Spring jars to the project
- Time for action – adding Java version properties in pom.xml
- Time for action – adding a welcome page
- Time for action – configuring the dispatcher servlet
- Time for action – running the project
- Summary
-
2. Spring MVC Architecture – Architecting Your Web Store
- The dispatcher servlet
- Time for action – examining request mapping
- The web application context
- Time for action – understanding the web application context
- The web application context configuration
- View resolvers
- Time for action – understanding InternalResourceViewResolver
- Model View Controller
- An overview of the Spring MVC request flow
- The web application architecture
- The domain layer
- Time for action – creating a domain object
- The persistence layer
- Time for action – creating a repository object
- The service layer
- Time for action – creating a service object
- An overview of the web application architecture
- Summary
-
3. Control Your Store with Controllers
- Defining a controller
- Time for action – adding class-level request mapping
- The role of a controller in Spring MVC
- Handler mapping
- Using URI template patterns
- Time for action – showing products based on category
- Using matrix variables
- Time for action – showing the products based on filter
- Understanding request parameters
- Time for action – adding the product details page
- Time for action – implementing a master detail view
- Summary
- 4. Working with Spring Tag Libraries
-
5. Working with View Resolver
- Resolving views
- The redirect view
- Time for action – examining RedirectView
- Serving static resources
- Time for action – serving static resources
- Time for action – adding images to the product detail page
- The multipart request in action
- Time for action – adding images to the product page
- Using ContentNegotiatingViewResolver
- Time for action – configuring ContentNegotiatingViewResolver
- Working with the handler exception resolver
- Time for action – adding the response status exception
- Time for action – adding an exception handler
- Summary
- 6. Intercept Your Store with Interceptor
- 7. Validate Your Products with a Validator
- 8. Give REST to Your Application with Ajax
- 9. Apache Tiles and Spring Web Flow in Action
- 10. Testing Your Application
- A. Using the Gradle Build Tool
- B. Pop Quiz Answers
- Index
Product information
- Title: Spring MVC Beginner’s Guide
- Author(s):
- Release date: June 2014
- Publisher(s): Packt Publishing
- ISBN: 9781783284870
You might also like
book
Spring MVC Beginner’s Guide
Unleash the power of the latest Spring MVC 4.x to develop a complete application About This …
book
Spring MVC Cookbook
Over 40 recipes for creating cloud-ready Java web applications with Spring MVC About This Book Configure …
video
Spring MVC For Beginners
Developing your first Spring MVC web application is fun. In this course, you will learn the …
video
Spring MVC for Java Developers
This screencast is designed to teach novice-level Java developers how to efficiently build well structured Java …