Weitere Ă€hnliche Inhalte Ăhnlich wie 10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013 (20) KĂŒrzlich hochgeladen (20) 10 Tips for Java EE 7 with PrimeFaces - JavaOne 20132. 10 Tips for Java EE 7 with PrimeFaces
Mert ĂalıĆkan
&
Martin Fousek
Software Architect
Software Developer
at T2 Yazılım Ltd.
at Oracle, NetBeans
3. The following is intended to outline our general product direction. It is intended
for information purposes only, and may not be incorporated into any contract.
It is not a commitment to deliver any material, code, or functionality, and should
not be relied upon in making purchasing decisions. The development, release,
and timing of any features or functionality described for Oracleâs products
remains at the sole discretion of Oracle.
3
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
4. Agenda
ï§ Introduction
â Java EE 7 & JavaServer Faces 2.2, PrimeFaces, NetBeans IDE
ï§ Tour through 10 features of the JSF and PF
â Feature overview
â Samples in action
4
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
5. Java EE 7 & JavaServer Faces 2.2
ï§
Java EE 7 â 14 JSRs and 9 MRs, themes:
â
â
Developer productivity
â
ï§
HTML5
Enterprise demands
JavaServer Faces 2.2 big ticket features:
â
â
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Faces Flow
â
5
HTML(5) Friendly Markup
Resource Library Contract
6. PrimeFaces
ï§
Open Source Component Library for JSF 2.x
JSF 2.2 is supported with PF version 4.x
ï§
Very Lightweight w/ Zero Configuration
ï§ Plenty of examples in Showcase, extensive
theming, provides mobile components
ï§ Well documented, user guides, books & etc.
ï§ Large and active community
6
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
7. NetBeans IDE
ï§
Open source IDE
ï§ Support for Java, PHP, C/C++, Groovy
ï§ Latest features
â Java SE 7, Java EE 7 and JavaFX
â HTML(5) client side development,
CSS preprocessors, JavaSciprt frameworks
â Cordova, FindBugs, VCS improvements
â PHP 5.4 and the newest PHP frameworks
7
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
8. Sample Codes
ï§
Sample codes to demonstrate the tips
ï§ Mavenized projects from Java EE 7 archetype
ï§ Repository:
github.com/marfous/j1demo-pf
8
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
10. HTML(5) Friendly Markup
ï§ New namespaces
â passthrough elements: http://xmlns.jcp.org/jsf (TagDecorator)
â passthrough attributes: http://xmlns.jcp.org/jsf/passthrough (RenderKit)
ï§ Advantages
â Getting control over rendered Facelets
â JSF components / JavaScript components / arbitrary mixing
â Write and style pure HTML with benefits of JSF
10
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
11. HTML(5) Friendly Markup
Form with usage of HTML friendly markup: validation by
Bean Validation API with localized messages, custom Bean
Validation annotation, passthrough attributes and elements,
usage of jQuery plugin at JSF component.
01-HtmlFriendlyMarkup
https://github.com/marfous/j1demo-pf
11
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
13. Resource Libraries Contracts
ï§ Theme definitions across one or more web applications
ï§ Libraries consisting of templates, insertion points, resources
ï§ Can be bundled directly into Web Application or within .jar library
ï§ How to choose the used one:
â there is only one option
â static or dynamic view definition
â URL based definition within faces-config
ï§ Multi-templating
13
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
14. Resource Libraries Contracts
Simple Resource Libraries Contracts usage, switching
RLCs dynamically using Expression Language and
ManagedBean.
02-ResourceLibrariesContracts
https://github.com/marfous/j1demo-pf
14
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
16. Expression Language 3.0
ï§ Communication between presentation layer and application logic
ï§ Deferred or immediate evaluation of expressions
ï§ Sets and gets data, invokes methods
ï§ Features
â Standalone ELProcessor
â Concatenation, semicolon and assignments operators
â Static collections
â Collection Operations (aligned with Java SE 8)
â Lambda Expressions (aligned with Java SE 8)
16
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
17. Expression Language 3.0
Examples of Expression Language 3.0 features:
standalone EL Processor, operators, static fields,
collections, lambdas and collection operations.
03-ExpressionLanguage3
https://github.com/marfous/j1demo-pf
17
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
19. -Prime Time with PrimeFaces Components
ï§ With 100+ Rich Set of Components
ï§ Built-in Ajax based on standard JSF 2.0 Ajax APIs
ï§ Client APIs based on
ï§ Enterprise theming w/ Theme Roller
With 4.0 â Sentinel Weâre introducing cool stuff like,
â Client Side Validation
â Dialog Framework
â Tree Drag & Drop
â Deferred Loading and many moreâŠ
19
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
20. -Prime Time with PrimeFaces Components
Examples on advanced UI components:
DataTable, Gmap, AutoComplete, Client Side
Validation, Tree Drag and Drop, The Dialog Framework
and others.
10-PrimeFacesComponents
https://github.com/marfous/j1demo-pf
20
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
21. In the Jungle of
PrimeFaces Themes
21
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
22. In the Jungle of PrimeFaces Themes
ï§ Powered w/ jQueryUI and ThemeRoller CSS Framework
Skinning and Structural CSS architecture
ï§ ThemeRoller provides visual editor to create new themes
ï§ ~40 themes available by only adding JAR dependency
ï§ Advanced themes are also available
â Twitter Bootstrap Theme
â Metro UI Theme ($$)
ï§ Configuration is done by <context-param> in web.xml
22
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
23. In the Jungle of PrimeFaces Themes
Theme variations on UI Components
Configuration of theme infrastructure
04-PrimeFacesThemes
https://github.com/marfous/j1demo-pf
23
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
25. PrimePush, PrimeUI and PrimeMobile
ï§ PrimePush brings first class support with Atmosphere Framework
â WebSockets, long polling, streaming, jsonp
ï§ PrimeUI is spin-off from the JSF suite, provides rich javascript widgets
â autoComplete, dataTable and many others (~35 components)
ï§ PrimeMobile offers UI components for mobile devices, supports for:
â powered by jQuery
25
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
26. PrimePush, PrimeUI and PrimeMobile
PrimePush Checkin Demo w/ PrimeMobile in Action
PrimeUI integrated with REST Services
05-PrimePushUiMobile
https://github.com/marfous/j1demo-pf
26
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
28. JSF scaffolding with PrimeFaces
ï§ Generation of CRUD skeleton from the database
â NetBeans IDE: JSPs or vanilla Facelets
â nbpfcrudgen plugin: Facelets with PrimeFaces
ï§ Last feature â NetBeans 7.3.1 generates CDI artifacts
ï§ Procedure
â Generate entity classes from database
â Generate JSF pages from entities
28
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
29. JSF scaffolding with PrimeFaces
CRUD application generation using standard
JavaServer Faces templates, generation of
PrimeFaces templates.
06-JsfPrimeFacesScaffolding
https://github.com/marfous/j1demo-pf
29
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
31. Faces Flows
ï§ Reusable collection of screens with defined entry and exit points
ï§ Nodes like switchNode, finalizer, methodCall etc.
ï§ Derived from proven technologies: Spring WebFlow, ADF Task Flow
ï§ JSF bound with CDI - @FlowScoped
ï§ Definition:
â Faces-config configuration file
â Java definition using FlowBuilder (@FlowDefinition)
31
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
32. Faces Flows
Sample wizard using navigation elements of the Faces
Flow, flow scope defined bean, Faces Flow component
as a plugable library.
07-FacesFlow, 07-FacesFlowLibrary
https://github.com/marfous/j1demo-pf
32
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
34. Annotation based component registration
ï§ Improved FacesComponent interface
ï§ Eliminates needs for the TLD file
ï§ CDI capable component
ï§ @FacesComponent(createTag = true,
namespace = ... , // implicitly: http://xmlns.jcp.org/jsf/component
tagName = ...)
34
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
// implicitly: lowercased class name
35. Annotation based component registration
Usage of the tag defined by @FacesComponent without
any tag library, CDI binding in the component, Java SE
project as a custom tag library.
08-FacesComponent, 08-FacesComponentLibrary
https://github.com/marfous/j1demo-pf
35
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
37. File Upload
ï§ Servlet 3.0 multipart architecture
ï§ Standard component with/without AJAX requests
ï§ For lower JSF versions already available as PrimeFaces component
ï§ Prerequisites
â Enctype multipart/form-data of the form
â Servlet 3.0
37
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
38. File Upload
File Upload of the standard JSF 2.2 and PrimeFaces
library in action, with validation of type and size limit.
09-FileUpload
https://github.com/marfous/j1demo-pf
38
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
39. PrimeFaces Cookbook
Over 90 practical
recipes to learn
PrimeFaces
written by:
Oleg Varaksin
& Yours Truly
Author discount 40%
with code: -
39
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.