Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

composite:renderFacet vs composite:insertFacet  RSS feed

 
Ranch Hand
Posts: 1686
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: 1686
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: 1686
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
 
Bartender
Posts: 19550
90
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.
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!