Spring MVC in Depth

Deep-drive into web application development with Spring MVC

Overview

This course provides an extremely detailed and comprehensive introduction to the Spring and Spring MVC Web Framework. By default only the modern, annotation driven, edition of the framework is covered (sometimes referred to as Spring @MVC) – but legacy features from earlier versions can be included if required.

In addition to conventional web development, the course also covers using the new features introduced in Spring 4 to create RESTful Web Services, which communicate with AJAX based clients using JSON for data exchange. Dojo is the AJAX framework used by default but other options (such as JQuery) can be used instead.

Outline

Review of Core Spring Concepts (Optional)

  • The benefits of Dependency Injection in OO development
  • Performing DI in Spring using XML bean definition files
  • How schema extensions enhance the core bean-wiring language
  • Performing DI in Spring 2.5 and above using annotations
  • Using Spring Expression Language to enhance DI
  • How Spring adds services on top of DI via AOP

Introduction to Spring MVC

  • The architecture of Spring MVC
  • Configuring the Spring Dispatcher Servlet
  • Placing web configuration in a separate XML file
  • Using the MVC schema extension to simplify configuration
  • Options for associating controller classes with URLs
  • The role of handler mappings and view resolvers
  • Overview of the built in mappers and resolvers

Mapping URLs to Controller Methods

  • Associating a controller with a single URL
  • Mapping methods to different HTTP verbs (GET, POST, PUT etc…)
  • Placing multiple business methods in the same controller
  • Executing a method based on the presence of a parameter
  • Executing a method based on the presence of a header

Receiving Input from the HTTP Request

  • Using @RequestParam to inject individual parameters
  • Populating a JavaBean with multiple parameters from the request
  • Using path variables to inject information from the URL
  • Injecting information from HTTP headers and cookies
  • Working with the entire body via @RequestBody
  • Passing objects from the Servlet API into business methods

Validating Input and Producing Output

  • Processing structured input via converters
  • Processing date and time input using @DateTimeFormat
  • Writing and calling your own validator objects
  • Validation using Springs support for JSR-303
  • Options for calling business services
  • Adding attributes to the model object

Options for Generating Views

  • Using @ResponseBody to bypass view pages
  • Using standard JSP pages for rendering
  • Making use of the MVC tag library in JSP’s
  • Creating composite views via the Tiles library
  • Using FreeMarker or Velocity instead of JSP’s
  • Using XSLT instead of conventional view pages
  • Configuring multiple view resolvers
  • Internationalizing view pages

Moving from Web Applications to REST

  • Review of the key concepts of RESTful services
  • Pros and cons of REST over SOAP services
  • Writing RESTful clients in Java using Apache HttpClient
  • Writing RESTful clients in Java using the Spring RestTemplate
  • Writing RESTful clients in AJAX using Dojo

Using Spring MVC in RESTful Scenarios

  • Using ContentNegotiatingViewResolver to handle multiple client types
  • Converting XML and JSON input into objects via JAXB and Jackson
  • Returning data feeds via AbstractAtomFeedView and AbstractRssFeedView
  • Returning XML via MarshallingView and JSON via JacksonJsonView

Requirements

  • Delegates must have a minimum of three years Java programming experience, preferably in JEE Web Application development.
  • In addition they should be proficient in authoring HTML/XML documents and familiar with the HTTP protocol and core concepts of AJAX.

Course Details

Duration
3 Days
Level
Intermediate
Location
UK / Ireland / Worldwide
Price
On Request
Book This Course

Sign up and stay in the loop

Be the first to know about upcoming workshops, courses, talks and events

Learn more

Great course. Covered Dependency Injection with Spring, Aspect Oriented Programming with Spring/AspectJ, Spring MVC and web services with Spring very well. This was one of the best courses I have been on. Garth talked around the subjects very well and supplied many alternatives, references and further reading material.