jsf2-composite-components
-
Upload
edward-burns -
Category
Technology
-
view
495 -
download
0
Transcript of jsf2-composite-components
![Page 1: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/1.jpg)
<Insert Picture Here>
True AbstractionJSF 2.0 Composite ComponentsEd Burns <http://ridingthecrest.com>JSF Technical LeadOracle America, Inc.
![Page 2: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/2.jpg)
2
Presentation GoalsPresentation Goals
• ShareShare the vision for the vision for composite componentscomposite components
• ExposeExpose you to everything you to everything you need to know to you need to know to master composite master composite componentscomponents
• DemonstrateDemonstrate the creation the creation of a non-trivial composite of a non-trivial composite componentcomponent
![Page 3: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/3.jpg)
3
Agenda: All About Composite Components
• Beginning– JSF 1.0 Vision and Reality– JSF 2.0 Vision– DEMO: A taste of the future
• Middle– Fundamentals– Practice– Small stuff (resource bundles, EL in resources, “this”)
• End– How to Think About Composite Components
![Page 4: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/4.jpg)
4
Speaker Qualifications: Ed Burns
– Consulting Staff Member at Oracle America, Inc.– Since inception, co-leader of the team that develops the JavaServer™
Faces (JSF) Specification– Co-author of the McGraw-Hill book, JavaServer Faces, The Complete
Reference and upcoming JSF2: The Complete Reference– Author of the McGraw-Hill book: Secrets of Rock Star Programmers:
Riding the IT Crest– Prior to JSF Ed worked on the Sun Java Plug-in, Mozilla Open JavaVM
Interface, NCSA Mosaic
![Page 5: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/5.jpg)
5
Beginning
![Page 6: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/6.jpg)
6
JSF 1.x Vision for Components
Create a market for re-usable JSF components, allowing developers to easily create UI's for web applications by combining off-the-shelf components from multiple vendors using nice GUI tools.
UserUserComponentsComponents
OracleOracleComponentsComponents
SunSunComponentsComponents
![Page 7: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/7.jpg)
7
JavaOne 2001 Technical Keynote
![Page 8: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/8.jpg)
8
JSF 1.X Component Reality
• Good– Very active and healthy component market– Very good IDE support
• Bad– Components not easy enough to build– Component vendors had to invent stuff because the spec didn't
solve• Ajax• Resource Loading• Library Ordering Precedence
![Page 9: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/9.jpg)
9
JSF 2.0 Vision for Compnents
• This...
![Page 10: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/10.jpg)
10
Make components easy to develop
• Becomes this...
![Page 11: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/11.jpg)
11
Make components easy to develop
• Or maybe this...
… if you want to get fancy• “Pay as you go” complexity
![Page 12: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/12.jpg)
12
JSF 2.0 Component Vision
• multi-select components on a JSF page
• press a “componentize” button• you get a wizard that lets you choose
how to expose the content of this component to the page author
• the component appears in a palette.
![Page 13: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/13.jpg)
13
Demo: Simple Login Panel
![Page 14: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/14.jpg)
14
Middle
![Page 15: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/15.jpg)
15
Composite Component Fundamentals
1.Resource Libraries
2.Conventions– XML Namespace
• Default namespace prefix + resource library name– Component name
• XHTML filename in resource library
3.<cc:interface> <cc:implementation>
4.Top level component creation
5.Attached Objects
6.#{cc} implicit object
![Page 16: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/16.jpg)
16
Fundamentals: Resource Libraries
• Completes the story for authoring web components– markup+css+script+images– JSF 1.2 only had 25% of that story!– All component artifacts bundled
together
• Allows the JSF lifecycle to serve up static content
• Fully localized, versioned• Dynamic
1. Web app root
2. Classpath
![Page 17: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/17.jpg)
17
Fundamentals: Conventions
• Naming Convention• Placement
Convention
![Page 18: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/18.jpg)
18
Demo: Conventions
Ask the audience for names, show error messages, as cc is created in the demo
![Page 19: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/19.jpg)
19
Fundamentals: <cc:interface> <cc:implementation>
• <cc:interface>– Declares everything in the page author needs to know to use
this component. This is more formally known as the usage contract.
• <cc:implementation>– Defines the implementation of the contract declared in the
<cc:interface> section
• <cc:interface> can be empty (will be optional in JSF2.next)
![Page 20: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/20.jpg)
20
Fundamentals: Top Level Component
![Page 21: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/21.jpg)
21
Fundamentals: Top Level Component
Rules for creating the Top-Level Component
1.See if the composite component declares acomponentType attribute on <cc:interface>
2.Look for a script based component with a file name that is the same name (case sensitive) as the .xhtml file name
3.Look for a java class called <resourceLibName>.<fileName>
4.Create a component of component type javax.faces.NamingContainer
![Page 22: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/22.jpg)
22
Fundamentals: Attached Objects
![Page 23: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/23.jpg)
23
Demo: Attached Objects
![Page 24: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/24.jpg)
24
Fundamentals: #{cc} implicit object
![Page 25: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/25.jpg)
25
Composite Components: Practice
![Page 26: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/26.jpg)
26
Composite Components: Small stuff
• Resource Bundles in composite component library• EL in resources• Nested composite component
![Page 27: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/27.jpg)
27
How do we enable this vision?
• Reduce the number of artifacts required• Provide a way to bundle associated resources with the component• Do it all dynamically, while the app is deployed• Allow the composite component to be a real component
– attached objects– children components– facets– ajax capable
• The “old way” still works.
![Page 28: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/28.jpg)
28
the past, present, and future of the computer human interface for network aware applications.
JSF 1.x
JSF 2.0
End
![Page 29: jsf2-composite-components](https://reader033.fdocuments.in/reader033/viewer/2022060107/5549abfbb4c905fa728b5582/html5/thumbnails/29.jpg)
29
How to think about Composite Components
• Building components should not be scary or hard
• Make everything private and expose only what the page author needs to see
• Just do it!