Prime Faces 3655

Embed Size (px)

Text of Prime Faces 3655


aatay iviciApache MyFaces PMC The Denitive Guide to Apache MyFaces and Facelets Co-Author Reference in Core JSF 2nd Edition (Sun Core Series) Technical reviewer of JBoss Seam and Trinidad and Apache MyFaces books Speaker in JSFOne, JSFDays, universities and local Java Groups. PrimeFaces founder and project lead Krank CRUD framework team member Trainer, Consultant, Mentor FC Barcelona fan Prime Teknoloji (UK-TURKEY)

Prime TeknolojiConsulting, Training, Software Development Agile Agile Agile, TDD, Patterns Java EE, JSF, Spring, Seam, JPA PrimeFaces

JSFJoint Strike Fighter Crew: 1

Java Server FacesStandard WEB Framework of JAVA EE Component Oriented Event driven Swing and WEB Apache MyFaces and Sun Mojarra (RI) Vendor support (Sun, IBM, Oracle, JBoss, Apache etc)

Apache MyFacesJSF 1.1 ve 1.2 implementation Tomahawk Trinidad Tobago Portlet Bridge RI Orchestra ExtVAL

JSF ToolsNetbeans JBoss Tools MyEclipse Eclipse WTP JDeveloper IBM RAD IDEA Macromedia Dreamweaver

Component LibrariesMyFaces Tomahawk MyFaces Trinidad MyFaces Tobago JBoss RichFaces IceFaces Quipukit NetAdvantage WebGalileo

PrimeFacesOpen Source Rich Components Easy AJAX XML Free JSF Detailed Documentation Not a framework

Open Source ModelMay the source be with you Free :) Apache Software Foundation Experience Turkey and Open Source

Turkish SupportTurkish Docs (160 + sayfa) Turkish enabled components Turkish support forum

PrimeFaces ModulesUI Components Optimus FacesTrace Mutually Exclusive modules

Installation1) Download 2) Logging ve SLF4J 3) Resource Servlet 4) JSP or Facelets Taglib 5) p:resources Lets ROCK!

Manuel DownloadGoogle code page:

Maven Download prime-repo Prime Technology Maven Repository default

org.primefaces primefaces-ui 0.8.1

Resource ServletServing packed resources (js, css, ...) Resource Servlet org.primefaces.ui.resource.ResourceServlet 1 Resource Servlet /primefaces_resources/*

TaglibJSP Taglib

Facelets Namespacexmlns:p=""

JSF Page

UI ComponentsRich components Easy AJAX Flash chart components Unobstrusive Javascript Yahoo UI, Prototype, Scriptaculous

Rich ComponentsUIAjax AccordionPanel AutoComplete Button Calendar Captcha Carousel Charts ColorPicker ConrmDialog Tooltip DataTable Dialog Editor ImageCropper Menu Panel Poll Resizable Slider Tabview Tree

Easy AJAXPartial Page Rendering - PPR Declarative AJAX

Ajax Update

Ajax StatusDisplaying Ajax request status Global Ajax Request indicator

AjaxifyEnables ajax on standard JSF components

Trigger on any DOM event blur, keyup, click, change

Ajaxify RemotingInvoking Java methods with JavaScript public void checkUser(ActionEvent actionEvent) { //Check }

Ajax PollingPeriodical Ajax Requests

private int number; public void increment(ActionEvent actionEvent) { number++; }

GraphsChart components (Pie, Line, Column and more) Interactive Live data display

Pie Chart Exampleprivate List sales; public SaleReport() { sales = new ArrayList(); sales.add(new Sale("Brand 1", 540)); sales.add(new Sale("Brand 2", 325)); sales.add(new Sale("Brand 3", 702)); sales.add(new Sale("Brand 4", 421)); }

Interactive ChartsItemSelectEvent

private String message; public void selectSeries(ItemSelectEvent event) { mesaj = "Item Index: " + event.getItemIndex() + ", Series Index:" + event.getSeriesIndex(); }

Live Data

SkinningBefore After

UI Components DEMO

Javascript and PrimeFacesYUI, Prototype, Scriptaculous PrimeFaces Namespace and Javascript API PrimeFaces.widget.* PrimeFaces.ajax.* Unobstrusive Javascript

PrimeFaces.widget.*PrimeFaces widgets Example: PrimeFaces.widget.Editor var editor = new PrimeFaces.widget.Editor(...);

PrimeFaces.ajax.*Ajax API PrimeFaces.ajax.AjaxUtils PrimeFaces.ajax.AjaxRequest PrimeFaces.ajax.AjaxResponse PrimeFaces.ajax.AjaxRequest(url, config, params);

Unobstrusive JavascriptVanilla JSF

PrimeFaces YAHOO.util.Event.addListener(_id1,click, function(e) { alert(Barca);}

OptimusNon rendering goodies Guice integration Validators XML-free JSF PDF and Excel export Security Extensions and AOP

Google Guice IntegrationGuice based JSF beans @Controller for Dependency Injection Aspect Oriented Programming

Vanilla JSF 1.x Managed-Beanpackage;

public class CreateUser { ... }


createUser request


Optimus IOCCreateUser.javapackage; @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { ... }



Controllername scope Request Session Application View startup: Initiate on application startup

Classpath scanningScan specic packages optimus.SCAN_PATH org.sopranos.project.ui

package org.sopranos.project.ui; @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { ... }

Dependency InjectionCreateUseruserDAO

UserDAO implements UserDAOJPA

Dependency Injectionpublic interface UserDAO { public void save(User user); } public interface UserDAOJPA implements UserDAO { public void save(User user) { //Persist with JPA, EntityManager.persist(user) } } public class MainAppModule implements Module{ public void configure(Binder binder) { binder.bind(userDAO.class).to(UserDAOJPA.class).in(Scopes.SINGLETON); } } optimus.CONFIG_MODULES org.sopranos.moviestore.MainAppModule

Simple InjectionNo getter and setterpackage; //imports @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { @Inject private UserDAO userDAO; //Other stuff public String saveUser() {; } }

Setter Enjeksiyonupackage; //imports @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { private UserDAO userDAO; @Inject public void setUserDAO(UserDAO userDAO) { this.userDAO = userDAO; } //Other stuff public String saveUser() {; } }

Constructor Injectionpackage; //imports @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { private UserDAO userDAO; @Inject public CreateUser(UserDAO userDAO) { this.userDAO = userDAO; } //Other stuff public String saveUser() {; } }

JPA Supportpersistence.xml org.hibernate.ejb.HibernatePersistence org.primefaces.examples.domain.Movie

web.xml Optimus Persistence Filter org.primefaces.optimus.persistence.filter.PersistenceFilter //filter mapping to Faces Servlet

JPA Supportweb.xml optimus.CONFIG_MODULES org.sopranos.moviestore.MainAppModule, org.primefaces.optimus.persistence.JPAModule

UserDAOJPA.javapublic interface UserDAOJPA implements UserDAO { @Inject private EntityManager em; public void save(User user) { em.persist(user); } }

TransactionsUserDAOJPA.javapublic void save(User user) { try{ em.getTransaction().begin(); em.persist(kullanici); em.getTransaction().commit(); }catch(Exception e){ em.rollbackTransaction(); } }

import org.primefaces.optimus.config.annotations.Transactional; //... @Transactional public void save(User user) { em.persist(user); }

ViewScopePage scope Between request and session scope Req View Sess.create.xhtml create.xhtml Create() Create() Create() Create() Create()


JSF 1.x NavigationuserList.xhtml



faces-cong.xml /userList.xhtml userDetail /userDetail.xhtml

Optimus NavigationuserList.xhtml



faces-cong.xml org.primefaces.optimus.navigationhandler.ViewIdBasedNavigationHandler

AuthContextUI Security

ifGranted ifAllGranted ifAnyGranted ifNonGranted

AOP and @AuthorizeMethod level securitypackage org.sopranos.project.ui; @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { public String saveUser() { if(isAdmin()) { //... } } } package org.sopranos.project.ui; @Controller(name=createUser, scope=Scope.REQUEST) public class CreateUser { @Authorize(ROLE_ADMIN) public String saveUser() { //... } }

ExporterExports datatable data, Excel or PDF ...

ExporterHTML DataTable

PDF RendererplayerDetail.jsf playerDetail.jsf ?asPDF=true

Collection ActionListenerList operations without custom java code ...

ValidatorsRegular Expression Validator Email Validator CreditCard Validator

FacesTraceDebug and Training tools Lifecycle visualizer Parameters (Request, Session vs) FacesMessages DHTML Component Tree Log4J support

LifeCycle Visualizer

FacesTrace DEMO

Project Homepage

DocumentationReferance Guide (160 + pages)

API ve TAG Docs


Support and HelpCommunity forum Enterprise support


Issue Tracker

Online Demo

Coming SoonJSF 2.0 compatibilty PrimeFaces 1.0 Drag-Drop components Flash based leupload Conversation Scope More transaction management More JPA support