Java EE: Getting Started with JavaServer Faces

JavaServer Faces is the Java EE standard component-based web application framework. This course will teach you how to use JSF to build a complete web application, including building the user interface and business logic.
Course info
Rating
(35)
Level
Intermediate
Updated
Jan 10, 2017
Duration
4h 18m
Table of contents
Course Overview
Getting Started
Creating Web Pages Using Facelets
Adding Business Logic Using Managed Beans and Expression Language
Handling User Input
Implementing Page Navigation
Building Your Own Components
Using AJAX
Description
Course info
Rating
(35)
Level
Intermediate
Updated
Jan 10, 2017
Duration
4h 18m
Description

At the core of building web applications with Java EE is a thorough knowledge of JavaServer Faces, the standard Java EE web application framework. In this course, Getting Started with JavaServer Faces, you will learn how to build web applications using JavaServer Faces. First, you will learn how to setup, build, and deploy a JSF project. Next, you'll explore how to create well-structured web applications using facelets and components, as well as how to handle user input. Finally, you'll learn how to work with AJAX to make your JSF web applications more dynamic. When you're finished with this course, you will have a foundational knowledge of JavaServer Faces that will help you move forward to become a proficient Java EE web application developer.

About the author
About the author

Jesper de Jong is an independent, experienced software developer and architect who designs and builds efficient, scalable, and high-quality server-side software for the JVM in Java and Scala. He loves the creativity of inventing and building software systems and loves to teach and share his knowledge with the software development community.

More from the author
Working with XML in Java Using JAXB
Intermediate
4h 6m
9 Jan 2018
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Jesper de Jong, and welcome to my course, Java EE: Getting Started with JavaServer Faces. I'm an independent software developer, and I have a lot of experience with designing and building systems using Java EE, which is the standard set of APIs for building enterprise Java software. Web applications are at the heart of online business, so if you're a professional software developer, you have to know how to build web applications. JavaServer faces is an important framework for building web applications because it's part of the Java EE standard. This course is an introduction to JSF for programmers who already know how to program in Java and who want to learn how to create web applications using JSF. Some of the major topics that we'll cover include using the facelets templating system to build web pages implementing business logic in manage beans, handling user input including validation and conversion, understanding and using navigation, and building your own JSF components. By the end of this course, you'll have a solid foundation to work on your own JSF web applications. Before beginning the course, you should be familiar with the Java programming language and have some basic knowledge on HTML. I hope you'll join me on this journey to learn JSF with the Java EE: Getting Started with JavaServer Faces course at Pluralsight.

Getting Started
Welcome to the course, Java EE: Getting Started with JavaServer Faces. My name is Jesper de Jong. This course is about JavaServer faces, a framework for building web applications in Java. In this first module of the course, I'll give you a high-level overview of what JavaServer Faces is. Then I'll say something about the context of this course and which other courses you might want to follow before and after this course. There will be lots of programming examples, and to get the most out of this course, I recommend that you follow along. You'll find that trying things out for yourself makes it much easier to understand and remember what you're learning. So we'll take a few moments to install and set up the tools that you'll need. Finally, we'll create a simple Hello World application so that you get an idea of how to build and deploy a JSF web application.

Adding Business Logic Using Managed Beans and Expression Language
Hello, and welcome to module three of the course, Getting Started with JavaServer Faces. This module is going to be fun because you're going to add business logic to our demo application so that it will start to function like a real web application. Until now, the pages of the application only contain fixed text. You're going to learn about the following topics. Business logic in JSF applications is implemented in managed beans, so I'm going to explain what managed beans are and how you can create your own managed beans. We'll be using CDI, Contexts and Dependency Injection, for the managed beans. I'll explain the principles of CDI and how it is used for managed beans in JSF applications. Managed beans have a scope. I'll explain the most important scopes that managed beans can have. To access managed beans from Facelets pages and to connect managed beans to JSF components, you use expression language. We already saw a little bit of this in the previous module. I'll explain in more detail what you can do with expression language. And of course, we're going to use managed beans in expression language to extend the demo application. We'll change the Home page and Product Details page so that they get the information about the products from a vacant service and we'll make the shopping cart work so that you can add and remove items and see what's in your shopping cart. Finally, we'll implement a way to let the user choose between the light and dark color schemes extending what we did with resource library contracts in the previous module. As you'll see, this is quite easy to do. Let's start with managed beans.

Implementing Page Navigation
Welcome to the next module of the course, Getting Started with JavaServer Faces. In this module, we're going to take a look at two subjects that have to do with page to page navigation in JSF applications. Of course, we have some links on the pages of the demo application so that a user can go from one page to another. At the moment, these are just straightforward links that point directly to the target page. For example, we've used h:outputLink components on several pages, which have a value attribute that points to the page that the links leads to. Navigation can, however, be done in a more sophisticated and flexible way. How that works is the first subject we'll look at in this module. The second subject for this module is Faces flows. This is, for example, useful if you have a sequence consisting of a number of steps that spin multiple pages, such as the checkout process of a web shop. You can use Faces flows to define the sequence of steps. We'll use Faces flows to define the checkout process in the demo application. At the end of this module, we'll have added pages for the checkout process to the demo application. On the Shopping Cart page, there is a button to start the checkout process, then there's a sequence of pages to enter your shipping details, payment details, and to review and confirm your order. After confirming your order, you will see a page to show whether your payment succeeded or not. The finish button on this last page takes you back to the Home page.

Building Your Own Components
Welcome to another module of the course, Getting Started with JavaServer Faces. JSF is all about components. There are a number of standard components, many of which we've already used in the demo and the examples you've seen so far. But what makes JSF really powerful is that you can create your own components which you can use just as quickly and easily as the standard components. In this module, we're going to look at how to create custom tag libraries and custom components. We will start with custom tag libraries. You can create your own custom tags which you can use on the pages of your application, which help you to be more expressive making it easier to create and maintain those pages. But a custom tag is not a full-blown self-contained component. So the next feature we'll look at is composite components. A composite component consists of a Facelets page, and optionally, a Java class that can contain state and methods that implement the behavior of the component. The JSF runtime system automatically provides a custom tag for a composite component so that you can use it on the pages of your application. After tags and composite components, you'll dive a little deeper. I'll first give you some more background on the UI component class hierarchy and then I'll give you an idea of what the possibilities are to make more advanced custom components and renderers. Finally, I'll give you a quick overview of existing JSF component libraries that offer many useful components which you can use in your application.