0% found this document useful (0 votes)
20 views

Javaserver Faces (JSF)

JavaServer Faces (JSF) is a server-side Java framework that provides a component-based model for building web interfaces. It allows separating user interface design from application logic through the use of reusable UI components and managed beans. Key features of JSF include built-in components, Facelets as the default view handler technology, bean annotations, and integration with Expression Language to connect UI components to backend objects.

Uploaded by

ali alsaeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Javaserver Faces (JSF)

JavaServer Faces (JSF) is a server-side Java framework that provides a component-based model for building web interfaces. It allows separating user interface design from application logic through the use of reusable UI components and managed beans. Key features of JSF include built-in components, Facelets as the default view handler technology, bean annotations, and integration with Expression Language to connect UI components to backend objects.

Uploaded by

ali alsaeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

JavaServer Faces (JSF)

‫أبيسلّوم‬
ّ .‫ م‬:‫إعداد‬
?What is JavaServer Faces
• JSF stands for Java Server Faces. It is a server-side Java
framework for web development.

• It consists of rich API and tag libraries.

• The JSF Tag libraries are used to add components on the web
pages and connect components with objects on the server.

• It is written in Java.
Benefit of JavaServer Faces

It provides clean and clear separation between behavior and


presentation of web application.

– You can write business logic and user interface separately.


JSF Features

• Component Based Framework


– It provides inbuilt components to build web application.

• Implements Facelets Technology.

• Bean Annotations.

• Integration with Expression Language.


Facelets Technology

• Facelets is an open source Web template system.

• It is a default view handler technology for JavaServer Faces


(JSF).

• Facelets supports all of the JSF UI components and focuses


completely on building the view for a JSF application.

• In short, the use of Facelets reduces the time and effort that
needs to be spent on development and deployment.
Faces Servlet

• Initializes resources
• Accepts all incoming JSF requests
• Passes requests to the request lifecycle for processing
• It validates expression language at compile-time.
• Faster compilation time.
• High-performance rendering.

– Mapping for the FacesServlet in the web.xml


• /faces/* - prefix mapping
JSF Managed Bean

• It is a pure Java class which contains set of properties and set


of getter, setter methods.

• Following are the common functions that managed bean


methods perform:

– Validating a component's data


– Handling an event fired by a component
– Performing processing to determine the next page to
which the application must navigate
Configuring beans

• You can use bean by

– using annotations.

– @ManagedBean annotation in a class automatically


registers that class as a resource with the JavaServer
Faces.
Configuring Managed Bean using Annotations

import javax.faces.bean.*;  
  
@ManagedBean    // Using ManagedBean annotation  
@RequestScoped  // Using Scope annotation  
.Request scope persists during a single HTTP request in a web application //

public class User {  
    private String name;  
    public String getName() {  
        return name;  
    }  
    public void setName(String name) {  
     this.name = name;  
}  
}  
Expression Language
• Expression Language (EL) provides an important mechanism
for creating the user interface (web pages) to communicate
with the application logic (managed beans)

<h:body>
<h:form>

> / "h:inputText value= " #{User. name}<

> / "h:outputText value= " #{User. name}<

</h:form>
</h:body>
Good luck

You might also like