This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

composite:renderFacet vs composite:insertFacet  RSS feed

 
Ranch Hand
Posts: 1724
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, what is the difference between composite:renderFacet and composite:insertFacet? I am not very clear even though there is an explanation in stackoverflow.
Let me use an example of Chapter 9 from Core JSF book:

I changed the composite:renderFacet into composite:insertFacet
//login.xhtml

//index.xhtml

If we use renderFacet for the login composite, the heading is displayed.
If use use insertFacet for the login composite, the heading is not displayed.
What is the difference between renderFacet and insertFacet?
renderFacet.JPG
[Thumbnail for renderFacet.JPG]
When renderFacet is used, the heading "Please log in" is displayed.
insertFacet.JPG
[Thumbnail for insertFacet.JPG]
When insertFacet is used, the heading is not displayed.
 
Himai Minh
Ranch Hand
Posts: 1724
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more example I tried is to add a data table to the composite component from the book:


//Index.xhtml that uses the composite login
renderTableCaption.JPG
[Thumbnail for renderTableCaption.JPG]
When the data table has a renderFacet, the caption is not rendered
insertTableCaption.JPG
[Thumbnail for insertTableCaption.JPG]
When data table has insertFacet, the caption is inserted
 
Himai Minh
Ranch Hand
Posts: 1724
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding to my previous posts


I think a form cannot have a f:facet. That is why the heading facet is not displaying.
See this post from stackoverflow: https://stackoverflow.com/questions/24937757/ffacet-not-working-with-hform
 
Saloon Keeper
Posts: 20511
115
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A composite is basically a custom control, and while I've been unable to do as much as I'd like with them thanks to working with obsolete applications, I think that they're mostly used where you define the custom control in a separate XML file.

And no, forms don't have facets. Facets generally define parameters to a JSF-unique control (such as a dataTable or panelGrid) and commonly are used where an element can have multiple child facets. The "h" namespace for JSF maps legacy HTML controls and HTML controls don't have facet-like behavior.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!