5 Day – Java Web Applications

A 5 day workshop designed to show how to build a functioning Java REST server with end to end connectivity (web client to database). The course will focus on the practicalities of building a Java server using Spring Boot, Spring JDBC Templates and web application clients based on Bootstrap and Angular JS.

A sample application will be used to illustrate the configuration and implementation of client/server 3-tier and MVC architectures. Use of behaviour driven development (BDD) and testing using JUnit, Cucumber, Jasmine and Protractor frameworks will also be discussed. The course does not include in-depth coverage of Java or JavaScript but simply describes sufficient features of both languages to meet the stated aim of a working web application.

Prerequisites

A basic knowledge of least one programming language sufficient to understand and use if statements, case (or switch) statements, loops and functions is required. Some experience of writing or modifying HTML web pages, styling pages using CSS and the ability to write simple SQL  statements. Knowledge of Java or JavaScript is not required.

Learning Objectives

To introduce staff to the basic concepts behind RESTful web services:

  • HTTP, XHR (AJAX) and REST protocols
  • 3-tier, Model View Controller (MVC) and Dependency Injection (DI) architectures
  • Basic Java and JavaScript syntax and features
  • Spring Boot framework configuration
  • Java REST web server annotations
  • Database access using Spring JDBC Templates
  • Web page layout using Bootstrap
  • Dynamic web pages using Angular JS
  • Testing using Junit, Cucumber, Jasmine and Protractor

Delivery

The workshop will guide developers through setting up an IDE development environment, use Maven to manage module dependencies and configure a Java REST web server using Spring Boot and Tomcat.  The course can be delivered using IntelliJ Community Edition or Eclipse for Java EE on Windows, Linux or Mac OS X.

Client side applications will use Bootstrap for page layout and Angular JS for page content and updates. Discussion of agile development techniques will include behaviour driven development and testing (BDD/TDD) using both JUnit (Java), Cucumber Jasmine and Protractor (JavaScript).

An exemplar application with be built and used for reference and the class will be guided through developing a similar application. Both applications will be simple form filling CRUD systems persisting data in an H2 database. Approximately 60% of the course will be devoted to hands on development of a web application.

Course outline

Day 1 – Java Applications

  • Tour of an IDE
  • Basic Java syntax
  • Java primitives
  • Objects and garbage collection
  • Running Java applications
  • Maven dependencies
  • Using logging (logback)
  • Unit testing with JUnit
  • BDD testing with Cucumber

Day 2 – Java Web Services

  • Client server architectures
  • Three tier applications
  • Building a Spring boot web server
  • Inheritance, Interfaces and anonymous classes
  • Using Spring REST annotations
  • Writing a REST service
  • Data formats: JSON/XML
  • RESTful protocols
  • GET/PUT/POST/DELETE
  • URL pathname mapping
  • Handling form data

Day 3 – Database Access

  • Server side concurrency issues
  • Thread safety
  • Spring JDBC templates
  • DB Connection pools
  • Using H2 for development
  • Dependency Injection
  • DAO and DTO design pattern
  • Client/server data exchange
  • Handling errors
  • HTTP response codes

Day 4 – Web Client

  • HTML5 and CSS
  • Bootstrap for Layout
  • Basic JavaScript syntax
  • JSON objects
  • Model, view controller (MVC)
  • architecture
  • Angular JS attributes
  • Data binding
  • Testing using Jasmine/ProtractorXHR requests
  • Web page interaction

Day 5 – Building Applications

  • Handling Dates
  • Stateful v Stateless web services
  • Managing server/client side state
  • SQL queries and stored procedures
  • Connecting to other databases