Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
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.
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
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.
Hello Vaadin! CS 3130 Summer 2015.
{ Apache - Click By, By, Anupam Mundale. Anupam Mundale. Viraj Kulkarni. Viraj Kulkarni.
Web programming for project students Dr Jim Briggs.
Apache Struts Technology A MVC Framework for Java Web Applications.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
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.
Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cobol, Perl, etc. The official Eclipse.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 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 Course Introduction and Overview.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
® IBM Software Group © 2006 IBM Corporation Web JSF Overview – Dynamic Content Web Pages – for EGL/JSF Developers This unit introduces you to the technical.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
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.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
1 Lecture 24 George Koutsogiannakis Spring 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
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.
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Introduction to Web Dimitar Nenchev Ivan Nakov
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.
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
CSCI 6962: Server-side Design and Programming Java Server Faces Scoping and Session Handling.
REVOLUTION TO NEXT GENERATION Struts2.0 20/02/ Avishek Arang ::
JavaServer Faces (JSF) and Ajax Integration. Agenda 대강의 ( 정말로..) 개요 예제 아키텍트라면..
1 Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
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.
CS320 Web and Internet Programming Web Application and MVC Chengyu Sun California State University, Los Angeles.
Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Chapter 44 JavaServer Face
Unit 6-Chapter 2 Struts.
MSIS 655 Advanced Business Applications Programming
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Chapter 39 JavaServer Face
JavaServer Faces: The Fundamentals
Presentation transcript:

Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM

Outlines  Overview of JSF 2.0  Required software  Installing Java SE 6  Installing Eclipse 4.2  Installing a server for JSF 2.0  Basic JSF Programming  Basic Structure of JSF 2.0 Application  Testing projects: Step by Step  Required JSF 2.1 and JSTL 2.0 libraries

Overview of JSF 2.0  JSF 2.0 adds many new features  Smart defaults  Annotations to replace many faces-config.xml entries  Ajax support  Integrated support for facelets  Simpler custom components  More components and validators  Lots more

Required software  JDK 1.6  JSF 2.x  Tomcat 6.0 or 7.0  Eclipse 4.2

Basic JSF Programming  Create JSF Project  Enable JSF 2.x capabilities – Manage Libraries  Create JSF Page  XHTML file  JSF Page Structure  Create / Use Template  Basic JSF Component  Managed beans  Structure of managed beans  Relationship between JSF page and managed bean

Basic JSF Programming  Navigation  Static  Dynamic  Converting and Validating data  Component Event Handling  Backing bean  User Interface Component Model  Data Table  CSS  Complex Table using backing bean and UI Component  JSF and AJAX

JSF Application Architecture  An entry in the Web application’s web.xml file enables the Faces Controller servlet when a certain URL pattern is specified, such as /faces/*. When running JSF 2.0 on a Servlet 3.0 container, the web.xml is optional. If no web.xml is found, the Faces Controller servlet is automatically mapped to the most popular URL patterns: /faces/*, *.jsf, and *.faces.  An optional JSF configuration file, faces-config.xml, allows for configuration of all elements of a JSF application. JSF has Java annotations for nearly everything that can be put in to the faces-config.xml, obviating the need for the file in most cases. This file is treated as a peer of the web.xml file and is usually located in the Web application’s WEB-INF/ directory.

JSF Application Architecture  Once a Java EE Web application is properly configured for JSF, you can construct the View using Facelets XHTML pages. (Versions of JSF prior to 2.0 emphasized JSP as the page declaration language. JSPs are indeed still supported in JSF 2.0, but few of the features unique to 2.0 are available to pages built with JSP.  For an XHTML page to be JSF-enabled, it must first contain JSF XML namespace directives provided by a JSF implementation. The following namespace directives are for the Core and HTML libraries available from all JSF implementations: <html xmlns= xmlns:h= xmlns:f=" <html xmlns= xmlns:h= xmlns:f="

JSF Application Architecture  Because this is XHTML, the HTML elements must be in all lowercase and must always be balanced. If the page processes form input, as opposed to just displaying output, you’ll need to add a tag as a child of the or tag. Subsequent child tags of the tag will become the form elements such as, which renders an input field, and, which renders a form submission button.

JSF-enabled XHTML page

The JSF Request Processing Lifecycle  When a JSF-enabled XHTML page is requested or when the user invokes an action on a UI component in a JSF-enabled XHTML page, it is important to understand the exact sequence of events that occur on the server in order to fulfill the request to view or submit a JSF page

The JSF Request Processing Lifecycle

The JSF Navigation Model  JSF follows a Model-View-Controller design paradigm. Recall that an MVC application is segmented into three distinct application components:  The Model, which contains the business logic or non-UI code  The View, which is all the code necessary to present a UI to the user  The Controller, which is a front-end agent that directly handles the user’s requests and dispatches the appropriate view

The JSF Navigation Model

Basic Structure of JSF 2.0 Application – JSF flow

Basic structure of JSF Page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <html xmlns=" xmlns:ui=" xmlns:h=" xmlns:f="

Basic Structure of Managed public class SomeBean { private String someProperty; public String getSomeProperty() public void setSomeProperty() public String actionControllerMethod() // Other methods } - Managed beans are Java classes that are declared - They have pairs of getter and setter methods corresponding to each input element in the form. - They have an action controller method that takes no arguments and returns a String. This is the method listed in the action of the h:commandButton in the input form.

@ManagedBean Basics public class SomeName { … }  You refer to bean with #{someName.blah}, where bean name is class name (minus packages) with first letter changed to lower case. Request scoped by default.  And “blah” is either an exact method name (as with action of h:commandButton), or a shortcut for a getter and setter method (as with value of h:inputText).  Return values of action controller method  If action controller method returns "foo" and "bar" and there are no explicit mappings in faces-config.xml, then results pages are foo.xhtml and bar.xhtml, From same folder that contained the form

Example

start-page.xhtml

Navigator.java

page1.xhtml

Results

Create First JSF Project  File  New  Dynamic Web Project  Specify Apache Tomcat v6.0 as Target Runtime  Dynamic web module version: 3.0  Configuration: JavaServer faces v2.1

Create First JSF Project  Next – Next into web module setting

JSF Capabilities – Manage Libraries  JSF Capabilities – Manage Libraries

Manage Libraries  New JSTL 2.1 and JSTL 2.0, add external JARs

Manage Libraries  Choose 2 Libraries and finish

Create JSF template  R-Click on webcontent – new – html file (đặt tên file có đuôi là.xhtml) – next – press HTML Template

Create JSF template  Press New (đặt tên + nôi dung template)

Create JSF Page  R-Click on webcontent – new – html file (đặt tên file có đuôi là.xhtml)

Create JSF Page  Press Next – Choose Template – Press Fisish

Create bean  R-Click Java Resource – new class

Setting default page... Faces Servlet *.xhtml start-page.xhtml