EC72 - Spring MVC Programming Workshop - 3 Days

Course Description

This course is targeted at application developers, already familiar with J2EE programming, looking to gain a knowledge of coding web applications using the Spring MVC Framework. During the course the student will write production quality examples that utilise many of the features the Spring MVC Framework has to offer.


Pre-requisites

The student should be familiar with J2EE Programming. They should have a good understanding of the basic concepts and the core J2EE API classes. This knowledge can be gained by attending courses EC31. Further practical experience is beneficial but not required.


Objectives

This course enables experienced Java developers to use the Spring MVC Framework.

This course provides students with the skills to write effective web applications using Spring MVC. During the course the student will write many components building up to a fully working application to ensure that the material taught is fully understood and practical experience is gained. On completion of this course the student will be able to:

  • understand the benefits of using Spring MVC
  • understand and be able to write all components of a Spring MVC application
  • configure a Spring MVC application
  • use the various custom tags that Spring MVC supplies
  • use Spring MVC Error Handling
  • use form validation
  • write unit tests for components


Environment

Development will be performed using:

  • Eclipse
  • IntelliJ
  • NetBeans
  • JBuilder


Customisation

For on-site courses (i.e. at your premises), we are more than happy to tailor the course agenda to suit your exact requirements. In many cases, we are able to build your in-house standards and naming conventions into the delivered course.


Course Details

INTRODUCTION TO SPRING MVC
DispatcherServlet: Front Controller Design Pattern
Under The Covers - From Request To View
Basic Example
Model Data
Views
Controllers
Deployment Descriptor
Spring Context for Servlet

PROJECT STRUCTURE
Web Project Structure
Directory Structure for WebContent Folder

CONFIGURATION
web.xml
applicationContext.xml
Dispatcher Context
Dispatcher Context - Scanning For Annotated Controller Classes
Dispatcher Context - Handler Mappings
Dispatcher Context - View Resolvers

CONTROLLERS
Defining Controllers: @Controller annotation
Autowiring Dependencies To Controllers: @Autowired
Mapping Requests: @RequestMapping
URI Templates and @PathVariable
Controller Methods Input Arguments
Binding request params to Objects
Binding Request Parameters To Method Parameters With @RequestParam
Returning From Controllers
Void Controller Methods
Returning Logical View Names
The WebDataBinder
Initialising With @InitBinder Methods
Initialising With AnnotationMethodHandlerAdapter
Initialising Property Editors
Allowed and Required Fields
Allowing Direct Field Access
Redirecting
Refresh Problem And Redirect After Post Solution
Passing Data When Redirecting
Redirecting to a JSP
Forwarding
Storing Attributes In The Session Using @SessionAttributes
Session Status
Enriching The Model: @ModelAttribute Methods

VIEWS
Spring JSP Form Tags
Common Attributes
Tag
Tag
Checkboxes, default and empty fields
Tag

JSTL: JAVASERVER PAGES STANDARD TAG LIBRARY
JSTL Expression Language
Nested References
Variables
Using The [] Operator
Implicit Objects
Operators
Core Tags
Variable Support Tags
Flow Control Tags
Iterator Tags
URL Generation (c:url)
Miscellaneous Tags
Internationalisation (I18n) Tags
Messaging Tags
Formatting Tags
Functions

VIEW RESOLVERS & VIEW TYPES
View Resolvers
ResourceBundleViewResolver
BeanNameViewResolver
XmlViewResolver
UrlBasedViewResolver
InternalResourceViewResolver
TilesViewResolver
View Types
InternalResourceView
JstlView
TilesView

INTERNATIONALISATION (I18N)
Resource Bundles
Locale Resolution
Internationalisation
Setting the locale programmatically
Internationalisation for Views
View Resolution
Dynamic Page Content

BINDING AND VALIDATION
Property Editors
Registering Property Editors
Custom Property Editors
Programmatic Validators
Jakarta Commons Validator
Valang (Va-lidation Lang-uage)
Bean Validation (JSR-303)
Displaying Errors for Fields

ADAPTORS AND INTERCEPTORS
Handler Adapters
Handler Interceptors

ERROR HANDLING
Programmatic Error Handling
Hard-Coded Error Messages
Messages From The Resource Bundle
Uncaught Exceptions & System Exceptions
Exception Resolvers
@ExceptionHandler

TILES
Configuring Spring for Tiles
Using Tiles definitions as Views
Templates
layout.jsp:
Definitions
tiles-definitions.xml:

TESTING
Unit Tests
Spring Mock Classes
ReflectionTestUtils
Using Spring With Unit Tests
Direct Field Access With Spring Configuration
Assembly (aka Integration) Tests


Course Format

Practical sessions make up a large part of the course, allowing delegates to demonstrate and reinforce the lectures given.

Examples are used extensively, ranging from simple code 'snippets' to full applications with complete 'real world' functionality. These are supplied at the start of the course and it is encouraged that the delegates execute and 'experiment' with these under the instructor's guidance as they are introduced.

These examples are available to take away, along with the delegate's own work.

The comprehensive Student Guide supplied is fully indexed serving as a useful reference tool long after the course has finished. Delegates will also be able to access a free help-line with technical questions relating to topics covered on the course.


Course Enquiry