Managed Bean • Exercise: Backing Managed Bean • Lecture: JSF Lifecycle • Exercise: Phase Listeners • Lecture & Exercise: Validation

Managed Bean • Exercise: Backing Managed Bean • Lecture: JSF Lifecycle • Exercise: Phase Listeners • Lecture & Exercise: Validation

Instructor Neil Griffin Member, JSR-314 (JSF 2.0) Expert Group [email protected] ICESOFT TECHNOLOGIES INC. www.icefaces.org Course Agenda • Lectures on standard JSF concepts • Learn by doing hands-on exercises – Eclipse 3.4 – Tomcat 6.0 • Lectures on ICEfaces • More hands-on exercises ICESOFT TECHNOLOGIES INC. www.icefaces.org Course Syllabus – Standard JSF • Lecture: Introduction to JSF • Exercise: Installing the ICEfaces Plugin for Eclipse 3.4 • Lecture: MVC Design Pattern • Exercise: Model Managed Bean • Exercise: Backing Managed Bean • Lecture: JSF Lifecycle • Exercise: Phase Listeners • Lecture & Exercise: Validation ICESOFT TECHNOLOGIES INC. www.icefaces.org Course Syllabus – Standard JSF (Cont.) • Lecture & Exercise: Converters • Lecture & Exercise: Internationalization • Lecture & Exercise: Value Change Listeners • Lecture & Exercise: Action listeners • Lecture & Exercise: Selection Components • Exercise: Support Managed Bean ICESOFT TECHNOLOGIES INC. www.icefaces.org Course Syllabus – ICEfaces • Lecture: Introduction to ICEfaces • Exercise: Convert Project to ICEfaces • Lecture: Layout Components • Lecture & Exercise: Auto-Complete • Lecture & Exercise: Rich Text Editor • Lecture & Exercise: File Upload & Ajax Push ICESOFT TECHNOLOGIES INC. www.icefaces.org Course Syllabus – Facelets • Lecture: Facelets • Example: Facelets Templating • Exercise: Facelets Composite Components & Ajax Push ICESOFT TECHNOLOGIES INC. www.icefaces.org To help protect your privacy, PowerPoint prevented this external picture from being automatically downloaded. To download and display this picture, click Options in the Message Bar, and then click Enable external content. Introduction to JSF ICESOFT TECHNOLOGIES INC. www.icefaces.org Required Tools • Java Developer Kit (JDK) 1.5/5.0 • Java EE IDE – Eclipse 3.3 for Java EE – Eclipse 3.4 for Java EE – MyEclipse 7 – NetBeans 6.5 • ICEfaces 1.8.1 Plugin for IDE • Tomcat 6 Servlet Container • Sun JSF 1.2 Reference Implementation (RI) ICESOFT TECHNOLOGIES INC. www.icefaces.org Introduction to JSF • What is JSF? – JavaServer Faces (JSF) is the standard web application framework for Java Enterprise Edition (Java EE) • Why should I use JSF? – As a Java standard, it has solid industry support – Growing in usage worldwide – Strong support in Java IDEs – ICEfaces is built upon JSF ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF History • JSR-127 defined and released the JSF 1.1 standard in 2004 – The JSR was co-chaired by Craig McClannahan, inventor of the popular Struts framework – Dependent on Java 1.4 and Servlet 2.4 • JSR-252 defined and released JSF 1.2 in 2006 – Introduced a dependency on Java 1.5/5.0 and Servlet 2.5 • JSR-314 began its work in May 2007 and plans to define and release JSF 2.0 in 2009 – ICEsoft Technologies Inc. is a member of the JSR-314 Expert Group ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF Implementations • The JSF API is basically a set of Java interfaces and abstract classes that define a contract by which a Reference Implementation (RI) must fulfill and abide by • There are two JSF RIs available, both in open-source: – Sun RI, code-named “Mojarra” • jsf-api.jar • jsf-impl.jar – Apache MyFaces RI • myfaces-api.jar • myfaces-impl.jar ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF Features • MVC: Implements the Model View Controller (MVC) design pattern • RAD: Rapid Application Development for web applications • UI Components: User Interfaces developed with reusable components – Many component suites available, such as ICEfaces • Render-Kits: Components can render themselves according to multiple client devices ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF Features (Cont.) • Extensibility: Framework is highly extensible via pluggable architecture – navigation-handler, view-handler, phase-listener, el-resolver, validators, converters • Internationalization: Views can manifest themselves in different languages ICESOFT TECHNOLOGIES INC. www.icefaces.org IDE / Tooling Support • JSF was designed to simplify UI construction for web applications • One of the key requirements was to support “tooling” such as Microsoft® Visual Basic style drag-n-drop design of pages • The following IDEs support some form of JSF tooling: – Eclipse* – MyEclipse* * ICEfaces plugin is available – NetBeans* – IntelliJ IDEA – BEA Workshop – Oracle JDeveloper ICESOFT TECHNOLOGIES INC. www.icefaces.org Servlet Container Compatibility • JSF 1.1 requires Servlet 2.4 and JSP 1.2 – Tomcat 5.5 – Jetty 5 – Resin 3.0 • JSF 1.2 requires Servlet 2.5 and JSP 2.1 – Tomcat 6.0 – Jetty 6 – Resin 3.1 ICESOFT TECHNOLOGIES INC. www.icefaces.org App Server Compatibility • Application servers fortify servlet containers with Enterprise JavaBeans (EJB) functionality – Note that JSF does not require EJB • JSF 1.2 is compatible with the following application servers: – Sun GlassFish – JBoss AS – BEA WebLogic – IBM WebSphere – Oracle AS ICESOFT TECHNOLOGIES INC. www.icefaces.org Portlet Compatibility • The JSR-127 (JSF 1.x) and JSR-168 (Portlet 1.0) specifications were both defined in the 2003 timeframe, and were designed to be interoperable • To run a JSF webapp as a portlet, a portlet bridge is required – The most popular bridge is the Sun OpenPortal JSF Portlet Bridge – JSR-301 is defining a portlet bridge API as a standard • The following portals (portlet containers) support JSF portlets: – Liferay Portal, JBoss Portal, Apache JetSpeed, BEA WebLogic Portal, IBM WebSphere Portal ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF HTML Component Tags • The JSF API requires the RI to supply a handful of basic UI components that manifest themselves as HTML: <h:form /> <h:commandButton /> <h:selectOneListbox /> <h:inputText /> <h:commandLink /> <h:selectOneMenu /> <h:inputTextarea /> <h:message /> <h:selectOneRadio /> <h:inputSecret /> <h:messages /> <h:selectBooleanCheckbox /> <h:inputHidden /> <h:panelGrid /> <h:selectManyCheckbox /> <h:outputLabel /> <h:panelGroup /> <h:selectManyListbox /> <h:outputLink /> <h:dataTable /> <h:selectManyMenu /> <h:outputFormat /> <h:column /> <h:outputText /> ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF Core Component Tags • The JSF API requires the RI to supply a handful of core UI components: <f:view /> <f:converter /> <f:loadBundle /> <f:subview /> <f:convertDateTime /> <f:selectItems /> <f:facet /> <f:convertNumber /> <f:selectItem /> <f:attribute /> <f:validator /> <f:verbatim /> <f:param /> <f:validateDoubleRange /> <f:actionListener /> <f:validateLength /> <f:valueChangeListener /> <f:validateLongRange /> • Most of the core tags represent objects that you would add to HTML components to augment their functionality • Complete list of tags with example screenshots can be found at www.corejsf.com ICESOFT TECHNOLOGIES INC. www.icefaces.org JSF Component Suites • The JSR-127 Expert Group wanted to foster a competitive marketplace of JSF components, which is the reason why the JSF API contains only a minimal set of them • The first “component suites” arrived on the scene shortly after JSF 1.1 was released in March, 2004: – Sun Woodstock Components – Apache MyFaces Tomahawk Components • On June 27, 2005, ICEsoft announced the Ajax-powered ICEfaces component suite: http://www.icesoft.com/corporate/press_release_05_09.html ICESOFT TECHNOLOGIES INC. www.icefaces.org Component Suite Interoperability • The original goal of JSF 1.1 was to have components from any component suite co-exist in the same JSF view • Unfortunately, JSF 1.1 did not define a standard way of implementing Ajax-enabled JSF components • JSF 1.2 added a method named UIComponent.invokeOnComponent() with Ajax in mind, but this still fell short of defining a standard • Because of the lack of a standard, Ajax-enabled component suites are currently not-interoperable • JSF 2.0 aims to define a standard, and restore interoperability once again • The ICEfaces component suite is interoperable with most of the components supplied by Tomahawk ICESOFT TECHNOLOGIES INC. www.icefaces.org Component Architecture • There are 3 parts to a component: – The Component Class – The Tag Class – The Renderer Class JSF Component Architecture ICESOFT TECHNOLOGIES INC. www.icefaces.org Component Tags • Component tags are placed on JSF pages/views: <h:outputText /> • Tag attributes allow developers to customize the appearance and behavior of components: <h:outputText value=“Hello World” rendered=“true” /> • Tags are nested in a parent-child containment format <h:form> <h:panelGroup> <h:outputLabel for=“fullName” /> <h:inputText id=“fullName” /> </h:panelGroup> </h:form> • The JSF framework manages the hierarchy in a component tree on the server ICESOFT TECHNOLOGIES INC. www.icefaces.org Component Tree • Although components are specified declaratively using XML markup, their runtime representation are Java class instances that are maintained by the JSF framework in a component tree • In a normal JSF web application the component tree has a short lifecycle (roughly the duration of a request+response) • In ICEfaces, the component tree has a much longer lifecycle, due to the nature of the ICEfaces extended- request scope ICESOFT TECHNOLOGIES INC. www.icefaces.org Exercise: Overview • The goal of this project is to create a new JSF project with Eclipse 3.4 • Although the project will not use any ICEfaces components, the ICEfaces libraries will be added to the project – ICEfaces bundles a custom version of Facelets which we will use as a convenience • The result of the exercise will be a simple web form: http://localhost:8080/jobApplication/applicantForm.iface

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    84 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us