FINAL JAVA SERVER FACES
-
Upload
rahul-chavan -
Category
Documents
-
view
68 -
download
3
Transcript of FINAL JAVA SERVER FACES
WHAT IS JAVA SERVER FACES?
Framework !!!
Provides set of reusable custom
components.
Provides set of JSP tags to access those
components.
DETAILED FEATURES OF JSF
JSF is standard web user interface framework for Java. Built on top of Servlet API. JSF is a component framework UI components are stored on the server. Easy use of third party components. Event driven programming model. Events generated by user are handled on the server. Navigation handling. Can automatically synchronize UI components. JSF supports multiple client devices. JSF has extensible architecture. International language support.
JSF ADVANTAGES
• Less code• Custom GUI controls.• Form validation• Event handling.
• Events can respond to particular buttons, changes in values, user selections, etc.
• Managed beans• JSF extends this capability and adds in
several utilities, which greatly simplifies processing of request parameters
JSF DISADVANTAGES
• Steep learning curve -- requires large JSF API as well as JSP and servlet APIs
• Less transparent – much is going on that you cannot see
• Relatively new – less documentation and less support from IDE
• Less flexible – cannot depart from the approach given by framework. Note: this consistency can be an advantage
• Not Enough Documentation.
Three main parts to JSF
• A Collection of GUI components• An Event Driven Programming Model• A component model supporting third party
component development
JSF ARCHITECTURE
JSF follows MVC framework Model: objects and properties of application View: Renderers take care of view. Controller: FacesServlet/ JSF infrastructure defines the
flow of the application.
Restore viewJSF keeps a copy of the client view and
component state on the server. During the restore view phase the JSF implementation will either create a new view for an initial page request, or render the server-side copy during a post-back request. Apply request values
Updates the server-side view with the new component values. Process validations
Performs conversion and/or validation of new component values.
Update model valuesUpdates the server-side components with
their new values. Invoke application
Invokes any server-side application logic contained within your managed bean. Render response
Renders the new view as directed by your backing bean and/or navigation mapping.
UI Component Model
JSF is all about UI component model.
Java Server Faces UI components are configurable, reusable elements that compose the user interfaces of Java Server Faces applications.
Java Server Faces technology provides a rich, flexible component architecture
User Interface Component Classes
JSF provides a set of UI component classes and associated behavioral interfaces that specify all the UI component functionality, such as holding component state, maintaining a reference to objects, and driving event handling and rendering for a set of standard components.
Component Rendering Model
The Java Server Faces component architecture is designed such that the functionality of the components is defined by the component classes, whereas the component rendering can be defined by a separate renderer. Single behavior of a component once but create multiple renderersA render kit defines how component classes map to component tags that are appropriate for a particular client.
Conversion Model
A Java Server Faces application can optionally associate a component with server-side object data.
When a component is bound to an object, the application has two views of the component's data:
The model view, in which data is represented as data types. Ex
The presentation view, in which data is represented in a manner that can be read or modified by the user.
Event and Listener Model
Java Server Faces technology supports three kinds of events: value-change events, action events, and data-model events.
An action event occurs when the user activates a component that implements ActionSource. These components include buttons and hyperlinks.
Validation Model
Implement a Validator interface that performs the validation.
Implement a backing bean method that performs the validation. If you are implementing a Validator interface, you must also: 1) Register the Validator implementation with
the application2) Create a custom tag or use a validator tag
to register the validator on the component.
Backing Bean (Model Object) Management
Binding a component instance to a bean property has these advantages:
The backing bean can programmatically modify component attributes. The backing bean can instantiate components rather than let the page author do so.
Binding a component's value to a bean property has these advantages: The page author has more control over the component attributes. The backing bean has no dependencies on the Java Server Faces API
Page Navigation
The Java Server Faces (JSF) Navigation Framework provides navigation rules that allow you to define navigation from view to view (mostly JSP pages) in a Web application.