Learn how to Build Back-End Web Apps with Java, JPA and JSF

book coverIn addition to the six tutorials listed below. we also offer a book not only containing the tutorials, but additional materials (such as a glossary, additional practice projects and quiz questions).

This 6-part in-depth tutorial shows how to build distributed Java web applications with Java Server Faces (JSF) as the user interface technology, the Java Persistence API (JPA) as the object-to-storage mapping technology, and a MySQL database.

 

  1. Building a Minimal Java Web App with JPA and JSF in Seven Steps
  2. Adding Constraint Validation
  3. Dealing with Enumerations
  4. Managing Unidirectional Associations
  5. Managing Bidirectional Associations
  6. Handling Class Hierarchies

 

Book detailsBuy the book Getting Ready to Run the Apps Visit discussion forum

1 Building a Minimal Java Web App with JPA and JSF in Seven Steps

An introductory tutorial for "early" app developers about developing Java web applications with minimal effort

In this first part of our 6-part tutorial we summarize the web's foundations and show how to build a distributed Java web application with minimal effort using Java Server Faces (JSF) as the user interface technology, the Java Persistence API (JPA) as the object-to-storage mapping technology, and a MySQL database.

Read the tutorial Run the app Get the code Ask a question

2 Adding Constraint Validation

A medium-level tutorial about developing Java web applications with constraint validation using Bean Validation annotations

This tutorial shows how to build a simple Java web application with constraint validation using JPA, JSF and Bean Validation annotations. The minimal Java web app that we have discussed in the first part of this 6-part tutorial has been limited to support the minimum functionality of a data management app only. However, it did not take care of preventing the users from entering invalid data into the app's database. In this second part of the tutorial we show how to express integrity constraints in a JavaBean model class with the help of Bean Validation annotations, and how to perform constraint validation both in the model part of the app and in the HTML5 user interface.

Read the tutorialRun the appGet the codeAsk a question

3 Dealing with Enumerations

A medium-level tutorial about developing Java web applications with enumeration attributes

In all application domains, there are string-valued attributes with a fixed set of possible string values. These attributes are called enumeration attributes, and the fixed value sets defining their possible string values are called enumerations. For allowing user input to an enumeration attribute, we can use the UI concept of a (drop-down) selection list, which may be implemented with an HTML select element. For user input to a single-valued enumeration attribute, a radio button group can be used instead of a single selection list, while for user input to a multi-valued enumeration attribute, a checkbox group can be used instead of a multiple selection list.

This tutorial shows how to build a Java web app where model classes have enumeration attributes implemented with the help of Java enums, and where the JSF Facelet templates are taking care of selection lists and choice widgets.

Read the tutorial Run the app Get the codeAsk a question

4 Managing Unidirectional Associations

An advanced tutorial about developing Java web applications with unidirectional associations

The three example apps that we have discussed in previous chapters, the minimal app, the validation app and the enumeration app, have been limited to managing the data of one object type only. A real app, however, has to manage the data of several object types, which are typically related to each other in various ways. In particular, there may be associations and subtype (inheritance) relationships between object types. Handling associations and subtype relationships are advanced issues in software application building. They are often not sufficiently discussed in software development text books and not well supported by application development frameworks. In this part of the tutorial, we show how to deal with unidirectional associations, while bidirectional associations and subtype relationships are covered in parts 5 and 6.

Read the tutorial Run the app Get the codeAsk a question

5 Managing Bidirectional Associations

An advanced tutorial about developing Java web applications with bidirectional associations

This tutorial shows how to build a Java web app that takes care of the object types Author, Publisher and Book as well as the bidirectional associations between Book and Author and between Book and Publisher. The app supports the four standard data management operations (Create/Read/Update/Delete). It extends the example app of part 4 by adding code for handling derived inverse reference properties, but it needs to be enhanced by adding subtype handling.

Read the tutorial Run the app Get the codeAsk a question

6 Handling Subtype Relationships in Class Hierarchies

An advanced tutorial about subtyping in Java web applications

This tutorial shows how to build a Java web app that manages subtype (inheritance) relationships between object types.

Read the tutorial Run the app Get the codeAsk a question

Back to top