JSF
JavaServer Faces (Jakarta Faces) - a component-based framework for Java web pages.
Overview
JSF is a server-side UI framework in which you build pages from reusable components and bind them to Java beans. It handles the request lifecycle, validation, conversion and navigation for you, which makes it a good fit for data-entry heavy business applications.
Combined with a component library such as PrimeFaces, you can build rich tables, forms, dialogs and charts with very little JavaScript.
Where it is used
- Internal business portals
- Admin dashboards
- Data-entry and reporting screens
- Jakarta EE web applications
A simple page and bean
<h:form>
<h:inputText value="#{studentBean.name}" required="true"/>
<h:commandButton value="Save" action="#{studentBean.save}"/>
<h:messages/>
</h:form>
@Named
@RequestScoped
public class StudentBean {
private String name;
public String save() {
// call a service to store the student
return "success";
}
// getters and setters
}
What you will cover
The key topics and features of JSF
Facelets
XHTML templates with composition and reusable layouts.
Backing Beans (CDI)
Connect the page to Java code with scoped beans.
Component Libraries
PrimeFaces and other libraries add ready-made UI components.
Validation & Converters
Built-in and custom input validation and data conversion.
Navigation & Lifecycle
Understand how a request moves through the JSF phases.
AJAX
Update parts of a page without a full reload using f:ajax.