Java Server Faces Introduction Harshavardhan M. Karkar Project Manager Info-Spectrum India Pvt. Ltd.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Apache Struts Technology
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
JavaServer Faces. Objectives To implement dynamic web pages with JavaServer Faces (JSF) technology To learn the syntactical elements of JavaServer Faces.
JSP Tag Extensions And Java Bean. JSP Tag Extensions Tag extensions look like HTML (or rather, XML) tags embedded in a JSP page. They have a special meaning.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
JavaServer Faces Dr Jim Briggs 1JavaServer Faces.
Java Server Faces Model/View/Controller Design Pattern for Web Development Slides adapted from “Core JavaServer Faces” by Geary and Horstmann and the J2EE.
Apache Struts Technology A MVC Framework for Java Web Applications.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
6 th Annual Focus Users’ Conference Application Editor and Form Builder Presented by: Mike Morris.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
® IBM Software Group © 2006 IBM Corporation Creating JSF/EGL Template Pages This section describes how to create.JTPL (Java Template Pages) using the Page.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
Java Server Faces Çağatay Çivici Apache MyFaces Team Member
IndicThreads.com Java Meet June 2006 Java Server Faces Presentation By - Raghu Charan.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
CSCI 6962: Server-side Design and Programming Validation Tools in Java Server Faces.
Automatic Generation of Web Interfaces From User Interaction Diagrams Filipe Bianchi Damiani Patrícia Vilain Federal University of Santa Catarina (UFSC)
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
1 Introduction to JavaServerFaces & MyFaces Anudeep Jassal.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
1 Lecture 24 George Koutsogiannakis Spring 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
JSF road map (NI) Clientside validation Show problems
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
CSCI 6962: Server-side Design and Programming Java Server Faces Components and Tags.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
CSCI 6962: Server-side Design and Programming Facelets and User Interface Design.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Apache Struts Technology A MVC Framework for Java Web Applications.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Standard JSF Tags Mimi Opkins CECS 493 Fall 2016.
Intro to JavaServer Faces Mimi Opkins CECS 493 Fall 2016.
J2EE Platform Overview (Application Architecture)
ORACLE ADF ONLINE TRAINING COURSE
JavaServer Faces: The Fundamentals
Web Development Using ASP .NET
Presentation transcript:

Java Server Faces Introduction Harshavardhan M. Karkar Project Manager Info-Spectrum India Pvt. Ltd.

What is JSF JSF is a great Java Technology for Web Application Development Developed by JCP (Java Community Process) comprising of web application experts from Jakarta Struts, Oracle, Sun, IBM, ATG etc. JCP References ocesshttp://en.wikipedia.org/wiki/Java_Community_Pr ocess

Why JSF Java Server Faces or JSF for short, is the standard framework to simplify the process of developing web application in java. Some Features –Robust Component Framework Offers set of UI Components –Event Driven Programming Model –Extensible Architecture

Who can use JSF Page authors –Web designers have experience with graphic design. They can design look and feel of web application in html/jsp using custom tag libraries of JSF. Application developers –Application developers can integrate this design with UI components. They program objects, event handles, converters, validator’s. Component writers –Component developer can build custom UI components because of JSF’s extensible and customizable nature. They can create their own components directly from UI component classes or extending the standard components of JSF. Application architects –Application architects are responsible for designing web applications. Defining page navigation, ensuring Scalability of application, configuring beans object registration are the key points that an application architect handles. Tool vendors –JSF is well suited for tool vendors, for example Sun Java Studio Creator application development tool, who provide tools that take advantages of JSF to create UI easier.

Short Summary Purpose of JSF –Faster Web Application Development –UI components with suitable API for State Management Event Management Validations

Benefits of JSF Some important benefits of JSF –JSF provides standard, reusable components for creating user interfaces for web applications. –JSF provides many tag libraries for accessing and manipulating the components. –It automatically saves the form data and repopulates the form when it is displayed at client side. –JSF encapsulates the event handling and component rendering logic from programmers, programmers just use the custom components. –JSF is a specification and vendors can develop the implementations for JSF.

Benefits of JSF… JSF is a component framework built on top of Servlet API. UI components are stored on the server. Event driven programming model. Events generated by user are handled on the server. International language support. Extensive tool support (Sun, Oracle, IBM etc.). Rapid application development approach.

JSF Versions The latest version of Java Server Faces technology is version 2.0, developed through the Java Community Process under JSR 314. You can download the 2.0 version of the specification from the JSR 314 web page. The latest implementation of version 2.0 can be downloaded from the Mojarra Project site. JSR Mojarra

JSF Components JSF includes mainly: –Set of APIs to represent and manage state of components that helps server side validation, event handling, page navigation, data conversion etc. –JSP custom tag library to create UI components in a view page. –Developers can focus on UI components, events handling, backing beans and their interactions rather than request, response and markup.

JSF Tags JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF provides over 40 tags in two standard JSF tag libraries: JSF Core Tags Library JSF Html Tags Library

JSF Tags Simple page structure with JSF tag libraries. …………… …………… In the above code fragment we have imported two JSF tag libraries with the help of taglib directive. JSF Core Tag Library contains set of JSF core tags while JSF Html Tags Library contains set of html tags. Prefix is used to use tags defined in tag library. Here we are using conventional names f and h for Core & Html tags respectively. We have the choice to choose any name for the prefixes.

JSF Html Tags These tags represent html components like text fields, buttons, form. Html tags can be divided into following categories: Inputs - inputText, inputTextarea Outputs - outputText, outputLabel Commands - commandButton Selections - selectOneRadio,selectOneListbox, selectOneMenu for radio buttons, list boxes, menu etc. Layouts - panelGrid Data table - dataTable Errors and messages - message, messages

JSF Html Tags In JSF Html Tag Library there are 25 core tags. column creates column in a dataTable commandButton creates button commandLink creates link that acts like a pushbutton dataTable creates a table control form creates a form graphicImage displays an image inputHidden creates hidden field inputSecret creates input control for password inputText creates text input control (single line) inputTextarea creates text input control (multiline) message displays the most recent message for a component

JSF Html Tags JSF Html Tag Library …. messages displays all messages outputFormat creates outputText, but formats compound messages outputLabel creates label outputLink creates anchor outputText creates single line text output panelGrid creates html table with specified number of columns panelGroup used to group other components where the specification requires one child element selectBooleanCheckbox creates checkbox selectManyCheckbox creates set of checkboxes

JSF Html Tags JSF Html Tag Library …. selectManyListbox creates multiselect listbox selectManyMenu creates multiselect menu selectOneListbox creates single select listbox selectOneMenu creates single select menu selectOneRadio creates set of radio buttons

JSF Core Tags These tags allows you to take advantages of features of JSF framework, like validation, conversion, event handling. Core library is stepchild of Html library. i.e. core library supports the html library. Core tag library also contains tags for views and sub-views, loading resource bundle, adding arbitrary text to a page. Some examples of JSF core tags are: f: view tag is used to create top level view f: subview tag is used to create subview of a view. f: validator tag is used to add a validator to a component.

JSF Core Tags f: converter tag is used to add an arbitrary converter to a component. f: actionListener tag is used to add an action listener to a component. f:valueChangeListener tag is used to add a valuechange listener to a component. Example f: view tag is used to create top level view and is a container for all JSF component tags on a page. The locale attribute provides several options for presenting localized views of your application. The "en" represents English and if we give value "fr" to locale attribute then french view will be displayed.

JSF Core Tags Another example head view Here f:subview tag is like container for the JSF components contained in an included JSP page (second.jsp). The Validator tag registers a Validator on the component associated with the enclosing tag. In validatorId field, we give the value of one of the validator-id element of a validator in your Faces configuration file.

List of JSF Core Tags f :view Creates the top-level view f:subview Creates a subview of a view f:attribute Adds an attribute to a component f:param Constructs a parameter component f:converter Adds an arbitrary converter to a component f:converterDateTime Adds a datetime converter to a component f:converterNumber Adds a number converter to a component f:actionListener Adds an action listener to a component f:valueChangeListener Adds a valuechange listener to a component f:validator Adds a validator to a component f:validateDoubleRange Validates a double range for a component’s value f:validateLength Validates the length of a component’s value

List of JSF Core Tags …. f:validateLongRange Validates a long range for a component’s value f:facet Adds a facet to a component f:loadBundle Loads a resource bundle, stores properties as a Map f:selectitems Specifies items for a select one or select many component f:selectitem Specifies an item for a select one or select many component f:verbatim Adds markup to a JSF page

List of JSF Core Tags …. f:validateLongRange Validates a long range for a component’s value f:facet Adds a facet to a component f:loadBundle Loads a resource bundle, stores properties as a Map f:selectitems Specifies items for a select one or select many component f:selectitem Specifies an item for a select one or select many component f:verbatim Adds markup to a JSF page

List of JSF Core Tags …. f:validateLongRange Validates a long range for a component’s value f:facet Adds a facet to a component f:loadBundle Loads a resource bundle, stores properties as a Map f:selectitems Specifies items for a select one or select many component f:selectitem Specifies an item for a select one or select many component f:verbatim Adds markup to a JSF page

JSF Sample Sample application structure with folders shown below

JSF Navigation Navigation is the heart of Java Server Faces. The navigation rule for this application is described in the faces-config.xml file. In our sample, we just want to go from inputname.jsp to greeting.jsp.

The faces-config.xml /pages/inputname.jsp greeting /pages/greeting.jsp personBean jsfks.PersonBean request

The Managed Bean package jsfks; public class PersonBean { String personName; /** Person Name */ public String getPersonName() { return personName; } /** Person Name */ public void setPersonName(String name) { personName = name; }

The Properties File (Resource Bundle) messages.properties inputname_header=JSF KickStart prompt=Tell us your name: greeting_text=Welcome to JSF button_text=Say Hello sign=!

JSP Pages inputname.jsp enter your name page

JSP Pages greeting.jsp greeting page,

Creating the index.jsp File We will now create a third JSP file that doesn't actually function as a presentation page. It uses a JSP tag to "forward" to the inputname.jsp page. Create the index.jsp file inside the WebContent folder. Note that this file is not created in the pages folder like the previous JSP files. Having an index.jsp file will allow us to start the application like this: If you look at the path for the forward, you'll notice the file suffix is.jsf and not.jsp This is used here, because in the web.xml file for the application *.jsf is the URL pattern used to signal that the forwarded page should be handled by the JavaServer Faces servlet within Tomcat.

The web.xml <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" " javax.faces.STATE_SAVING_METHOD server javax.faces.CONFIG_FILES /WEB-INF/faces-config.xml com.sun.faces.config.ConfigureListener Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.jsf