Spring MVC Beginner’s Guide


Spring MVC Beginner’s Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.95
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$67.94
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Carefully crafted exercises, with detailed explanations for each step, to help you understand the concepts with ease
  • You will gain a clear understanding of the end to end request/response life cycle, and each logical component’s responsibility
  • Packed with tips and tricks that will demonstrate the industry best practices on developing a Spring-MVC-based application

Book Details

Language : English
Paperback : 304 pages [ 235mm x 191mm ]
Release Date : June 2014
ISBN : 1783284870
ISBN 13 : 9781783284870
Author(s) : Amuthan G
Topics and Technologies : All Books, Application Development, Web Development, Beginner's Guides, Open Source


Table of Contents

Preface
Chapter 1: Configuring a Spring Development Environment
Chapter 2: Spring MVC Architecture – Architecting Your Web Store
Chapter 3: Control Your Store with Controllers
Chapter 4: Working with Spring Tag Libraries
Chapter 5: Working with View Resolver
Chapter 6: Intercept Your Store with Interceptor
Chapter 7: Validate Your Products with a Validator
Chapter 8: Give REST to Your Application with Ajax
Chapter 9: Apache Tiles and Spring Web Flow in Action
Chapter 10: Testing Your Application
Appendix A: Using the Gradle Build Tool
Appendix B: Pop Quiz Answers
Index
  • Chapter 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
      • Spring MVC dependencies
    • Time for action – adding Spring jars to the project
    • Time for action – adding Java version properties in pom.xml
      • A jump-start to MVC
    • Time for action – adding a welcome page
      • The dispatcher servlet
    • Time for action – configuring the dispatcher servlet
      • Deploying our project
    • Time for action – running the project
    • Summary
  • Chapter 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
  • Chapter 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
  • Chapter 4: Working with Spring Tag Libraries
    • Serving and processing forms
    • Time for action – serving and processing forms
    • Customizing data binding
    • Time for action – whitelisting form fields
    • Externalizing text messages
    • Time for action – externalizing messages
    • Using Spring Security tags
    • Time for action – adding a login page
    • Summary
  • Chapter 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
  • Chapter 6: Intercept Your Store with Interceptor
    • Working with interceptors
    • Time for action – configuring an interceptor
    • Internationalization (i18n)
    • Time for action – adding internationalization
    • Audit logging
    • Time for action – adding the data audit interceptor
    • Conditional redirecting
    • Time for action – intercepting offer page requests
    • Summary
  • Chapter 7: Validate Your Products with a Validator
    • Bean validation
    • Time for action – adding bean validation support
    • Custom validation with JSR-303 / bean validation
    • Time for action – adding custom validation support
    • Spring validation
    • Time for action – adding Spring validation
    • Time for action – combining Spring and bean validations
    • Summary
  • Chapter 8: Give REST to Your Application with Ajax
    • Introducing REST
    • Time for action – implementing RESTful web services
    • Time for action – consuming REST web services
    • Handling a web service in Ajax
    • Time for action – consuming REST web services via Ajax
    • Summary
  • Chapter 9: Apache Tiles and Spring Web Flow in Action
    • Working with Spring Web Flow
    • Time for action – implementing the order-processing service
    • Time for action – implementing the checkout flow
      • Understanding the flow definition
      • Understanding the checkout flow
    • Time for action – creating views for every view state
    • Enhancing reusability through Apache Tiles
    • Time for action – creating views for every view state
    • Summary
  • Chapter 10: Testing Your Application
    • Unit testing
    • Time for action – unit-testing domain objects
    • Integration testing with the Spring Test Context framework
    • Time for action – testing the product validator
    • Time for action – testing the product controller
    • Time for action – testing REST controllers
    • Summary

Amuthan G

Amuthan G has over six years of experience as a professional software developer. He currently works for a large cloud platform company and has strong product development experience in Java, Spring, JPA, and many other enterprise technologies. In his free time, he enjoys blogging on his site (http://www.madebycode.in). He can be contacted at mr.amuthan@gmail.com.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 4 submitted: last submission 15 Jul 2014

Page number: 213

Qauntity

should be:

Quantity

Page number: 167

additonally

should be:

additionally

Page number: 13

operating system architecture type (32 bit or 62 bit)

should be:

operating system architecture type (32 bit or 64 bit)

Pg no: 61 | Chapter 2: Time for action – creating a service object
(Step 4)

public void processOrder(String productId, long quantity) {
Product productById = productRepository.
getProductById(productId);
if(productById.getUnitsInStock() < quantity){
throw new IllegalArgumentException("Out of Stock. Available
Units in stock"+ productById.getUnitsInStock());
}
productById.setUnitsInStock(productById.getUnitsInStock() -
quantity);
}
}

 

should be:

 

public void processOrder(String productId, int count) {
Product productById = productRepository.
getProductById(productId);
if(productById.getUnitsInStock() < count){
throw new IllegalArgumentException("Out of Stock. Available
Units in stock"+ productById.getUnitsInStock());
}
productById.setUnitsInStock(productById.getUnitsInStock() -
count);
}
}

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Spring MVC Beginner’s Guide +    Mastering Kali Linux for Advanced Penetration Testing =
50% Off
the second eBook
Price for both: $41.55

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • 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

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.

Approach

A step-by-step pragmatic approach to web application development using Spring MVC, with relevant screenshots and concise explanations.

Who this book is for

This book is aimed at helping Java developers who want to teach themselves Spring MVC, even if they have no previous experience with Spring MVC. It would be helpful to have a bit of familiarity with basic servlet programming concepts, but no prior experience is required.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software