Presentation is loading. Please wait.

Presentation is loading. Please wait.

JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND.

Similar presentations


Presentation on theme: "JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND."— Presentation transcript:

1 JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630

2 POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND CODE AJAX FUNCTIONALITY

3 JAVA SERVER FACES A Java Web Application Framework It is a set of UI Components It consists of API’s to represent components, manage states, validate inputs It uses custom tag libraries to use JSF in JSP Navigations Back End Data Integration

4 Why JSF? JSP and Servlet – No built-in UI component model Struts – No built-in UI component model – No built-in event model for UI components – No built-in state management for UI components – No built-in support of multiple renderers – Not a standard Struts and JSF can be used together

5 Architecture Model View Controller Model : Managed Beans View : JSP Pages Controller : Components, Listeners

6 JSF VERSIONS JSF 1.0 JSF 1.1 JSF 1.2 Part of J2EE 5.0 Dependant on: JDK 1.4, Servlet 2.5

7 USER INTERFACE COMPONENT MODEL UI components Event handling model Conversion and Validation model Rendering model Page navigation support

8 UI COMPONENTS UICOMPONENT / UICOMPONENTBASE It is a base class for all UI Components. Standard UIComponent Subclasses UICommand UIForm UIOutput UIInput UIGraphic UIPanel UIParameter, UISelectBoolean

9 VALIDATORS AND CONVERTORS VALIDATORS Perform correctness checks on UIInput values

10 VALIDATORS AND CONVERTORS CONVERTORS They are plugin for conversions.

11 VALIDATORS AND CONVERTERS EXAMPLE Converter Validators <h:input_text valueRef=”testingBean.today”

12 RENDERING MODEL RENDERERS – Adapt components to certain mark up languages RENDER KITS – Libraries for Rendering Map component classes to component tags Is a custom tag library Basic HTML Render Kit

13 EVENTS AND LISTENERS Follows java beans design and patterns Standard Events and Listeners Action Event – UICommnad component activated by the user. Value Changed Event – UIInput component whose value has changed just now

14 NAVIGATION MODEL Defined in Application Configuration file Facesconfig.xml Navigation Rules determine Pages to go next and Navigation case

15 NAVIGATION MODEL /login.jsp success /welcome.jsp failed /error.jsp

16 JSF STRUCTURE It comprises of model objects such as managed beans that hold the data. These managed beans are added to Faces- config.xml Create pages using UI component and Tags Define page navigation in faces-config.xml Configure web.xml

17 Managing Beans The model (M) in MVC A regular JavaBeans with read/write properties and get/set methods. May contain application methods and event handlers Use to hold data from a UI (page) JSF keeps the bean's data in sync with the UI

18 Example : PersonBean public class PersonBean { String personName; /** * return Person Name */ public String getPersonName() { return personName; } /** * param Person Name */ public void setPersonName(String name) { personName = name; }

19 Managed Bean Declaration PersonBean myapp.PersonBean request

20 CREATING JSF PAGES Must include JSF tag library HTML and core tags All JSF tags must enclosed between a set of view tag Use JSF form and form component tags May include validators and event listeners on any form components

21 SAMPLE JSP PAGE(greeting.jsp) greeting page

22 PAGE NAVIGATION RULES /pages/inputname.jsp greeting /pages/greeting.jsp personBean jsfks.PersonBean request

23 CONFIGURE web.xml javax.faces.application.CONFIG_FILES /WEB-INF/faces-config.xml Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/*

24 JSF DIRECTORY STRUCTURE WEB-INF/web.xml WEB-INF/faces-config.xml WEB-INF/classes/PersonBean.class Greeting.jsp Inputname.jsp Index.jsp

25 JSF AND AJAX JSF allows to create its own portable components. This characterstic makes JSF perfect companion to AJAX. No Need to write Javascript code. Component Developers can directly encapsulate the components

26 THANK YOU


Download ppt "JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND."

Similar presentations


Ads by Google