Wednesday, January 11, 2012

Making JSF 2.0 Composite Components Ajax render-capable

Satukancinta-user-follow-jsf-a

If you for example have the following composite component in a JSF 2.0 Facelets XHTML template:

<sc:block title="Followers">

<h:panelGroup rendered="#{not empty userShow.user.followedByUsers}">

<ul>

<ui:repeat var="user" value="#{userShow.user.followedByUsers}">

<li><sc:user_link user="#{user}"/></li>

</ui:repeat>

</ul>

</h:panelGroup>

<h:panelGroup rendered="#{empty usefollowedByUsers}">

#{userShow.user.name} has no followers.

</h:panelGroup>

</sc:block>

and try do ajax render:

<a4j:commandButton value="Follow" action="#{userBean.follow(currentUser, userShow.user)}"

render="followPanel followers"

rendered="#{not currentUser.isFollowing(userShow.user)}"/>

This won't work for some reason. Wrong workaround is using a h:panelGroup and moving the id for ajax render there:

<sc:block title="Followers">

<h:panelGroup id="followers">

<h:panelGroup rendered="#{not empty userShow.user.followedByUsers}">

<ul>

<ui:repeat var="user" value="#{userShow.user.followedByUsers}">

<li><sc:user_link user="#{user}"/></li>

</ui:repeat>

</ul>

</h:panelGroup>

<h:panelGroup rendered="#{empty us.followedByUsers}">

#{userShow.user.name} has no followers.

</h:panelGroup>

</h:panelGroup>

</sc:block>

The correct solution is to put a #{cc.clientId} like below in the composite implementation:

<composite:implementation>

<section id="#{cc.clientId}" class="block">

<div class="block-inner clearfix">

<h2 class="block-title">#{cc.attrs.title}</h2>

<div class="block-content content">

<composite:insertChildren/>

</div>

</div>

</section>

</composite:implementation>

To learn more about Java Web Development using Java EE 6, I highly recommend The Java EE 6 Tutorial: Basic Concepts (4th Edition) (Java Series) by Eric Jendrock, Ian Evans, Devika Gollapudi and Kim Haase.

12 comments:

davit hogg said...
This comment has been removed by the author.
davit hogg said...

I just came from natural stone countertops werkblad.be where they (as also counter tops) selling composiet,keramiek,terrazzo,graniet. It looked like a fashion website how the products are presented. What do you think about that?

Anonymous said...

"Really awesome work with the blog. I do like your hard work on and will wait for more post as from you as post gave me pleasure and gives some helps to do same work right here. Thanks a lot……………"www.glasshousecontemporary.com |

www.legallisted.com |

www.eomtion-sports.com |

www.gulfshorescomputers.com |

www.weddingplanningalacarte.com |

www.bkkautolease.com |

coach outlet store online said...

http://www.coachoutletstoreinc.com/ Coach Outlet Store Online

http://www.michaelkorsoutletmkinc.com/ Michael Kors Outlet

http://www.coachfactoryoutletwebsite.com/ Coach Factory Outlet

http://www.tomsusashoes.com/ Toms Shoes

http://www.cheapjerseysinc.com/ Cheap Jerseys

http://www.michaelkors-bedford.com/ Michael Kors

http://www.coachoutlet-sale.com/ Coach Outlet

http://www.coachfactoryoutletorg.com/ Coach Factory Outlet

http://www.coachoutlet-buy.com/ Coach Outlet

http://www.coachhandbagsonlineoutlet.com/ Coach Handbags

http://www.giuseppezanottionline.com/ Giuseppe Zanotti

http://www.coachfactoryoutlet-handbags.com/ Coach Factory Outlet

http://www.coach-factory-outlet-online.com/ Coach Factory Outlet Online

http://www.coachstoreonline.com/ Coach Outet Store Online

http://www.coachfactoryoutlets2014.com/ Coach Factory Outlet

http://www.michaelkorsoutletonlinemk.com/ Michael Kors Outlet Online

http://www.celineoutlet-online.com/ Celine Outlet

http://www.michaelkors.name/ Michael Kors

http://www.michael-kors-outlet-store.com/ Michael Kors Store

http://www.tomsshoescompany.com/ Tomss Hoes

http://www.pradaoutlet-store.com/ Prada Outlet

http://www.fitflopfootwear.com/ Fitflop Footwear

http://www.celinebags-outlet.com/ Celine Bags

http://www.fitflopsflipflops.com/ Fitflops Flipflops

http://www.fitflopusaonline.com/ Fitflops

http://www.giuseppezanottidesigner.com/ Giuseppe Zanotti Designer

http://www.fitflopflip-flop.com/ Fitflops

http://www.giuseppezanottisneakersmen.com/ Giuseppe Zanotti Sneakersmen

http://www.fitflopsandalssale.com/ Fitflops

Anonymous said...

Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us.http://www.rn-ds-partnership.co.uk |

http://www.prepaybank.co.uk |

http://www.calleija.co.uk |

http://www.dontdothedodo.co.uk |

http://www.intelligentformulation.co.uk |

http://www.caphe-vn.co.uk |

http://www.futrets.co.uk |

http://www.auction-expert.co.uk |

http://www.sail-lizziemay.co.uk |

http://www.dubai-realestate.co.uk |

polo outlet said...

http://www.burbagssale2014.com/ Burberry Outlet
http://www.airmaxshoesfactory.com/ Air Max Shoes
http://www.coachblackfriday2014.com/ Coach Black Friday
http://www.coach-storeoutletonline.com/ Coach Black Friday
http://www.coachcoachoutlet.com/ Coach Cyber Monday
http://www.coachxfactory.com/ Coach Factory
http://www.coach-factoryoutletonline.net/ Coach Outlet Factory
http://www.coach-outletonlineusa.com/ Coach Outlet USA
http://www.coach-pursesfactory.com/ Coach Purses Factory
http://www.coachpurseusa.com/ Coach Purses USA
http://www.coach-storeoutlet.com/ Coach Store Outlet
http://www.coach-pursesonline.com/ Coach Purses On Sale
http://www.monsterbeatsbydres.com/ Monster Beats Outlet
http://www.louis-vuittonblackfriday.com/ Louis Vuitton Outlet
http://www.lv-guccishoesfactory.com/ Louis Vuitton Factory
http://www.marcjacobsonsale.com/ Marc Jacobs On Sale
http://www.mcmworldwides.com/ MCM Outlet
http://www.mcmoutlet-jp.com/ MCM 店铺
http://www.oakleysunglassesfactory.com/ cheap oakley sunglasses
http://www.michaelkorsmas.com/ Michael Kors Outlet
http://www.michaelkors.so/ Michael Kors Outlet
http://www.michaelkorsfactory-store.com/ Michael Kors Factory
http://www.michaelkorsoutletr.com/ Michael Kors Outlet
http://www.michael-korsfactoryonline.com/ Michael Kors Factory Online
http://www.newcoachfactoryoutlet.com/ Coach Factory Outlet
http://www.north-faceoutletonlines.net/ North Face Outlet Online
http://www.polo-outletstore.com/ Polo Outlet Store
http://www.ralph-laurenhome.com/ Ralph Lauren UK
http://www.saclongchamppairs.com/ Sac Longchamp Pairs
http://www.tcoachoutletonline.com/ Coach Outlet Online
http://www.the-coachfactoryoutlet.com/ Coach Factory Oultet
http://www.barbour-jacketsoutlet.com/ Barbour Jackets Outlet Online
http://www.canada-gooser.com/ Canada Goose Outlet
http://www.guccishoesuk-2014.com/ Gucci Outlet Online
http://www.michaelkorsstates.com/ Michael Kors Outlet
http://www.moncler-clearance.com/ Moncler Clearance
http://www.moncler-jacketsoutletonline.com/ Moncler Jackets Outlet Online
http://www.northsclearance.com/ North Clearace Outlet
http://www.polo-ralphlaurenonline.com/ Polo Ralph Lauren Outlet Online
http://www.woolrich-clearance.com/ Woolrich Clearance
http://www.cvshopfactory.com/ shop.coachfactory.com
http://www.mksfactoryoutlet.com/ Michael Kors Factory Outlet
http://www.zxcoachoutlet.com/ Coach Outlet Online USA
http://www.thebeatsbydre.net/ Beats by Dre
http://www.superbagsmarket.com/
http://www.newoutletonlinemall.com/ Coach Purses Outlet Online
http://www.clickmichaelkors.com/ Michael Kors USA

natuursteen werkblad said...

Natuursteen zoals graniet maar ook composiet en keramiek koopt u bij Natuursteen-Werkblad.be rechtstreeks uit de fabriek. Daardoor bieden wij u de scherpste prijzen en een gegarandeerde hoge kwaliteit werkbladen met merken van onder andere Compac en Silestone.
Read more:-http://natuursteen-werkblad.be/

oakleyses said...

burberry handbags, prada outlet, ray ban sunglasses, gucci handbags, tiffany and co, louis vuitton, christian louboutin outlet, christian louboutin uk, tory burch outlet, ray ban sunglasses, polo ralph lauren outlet online, louis vuitton outlet, jordan shoes, michael kors outlet online, nike air max, christian louboutin, ray ban sunglasses, louis vuitton outlet, longchamp outlet, prada handbags, michael kors outlet online, uggs outlet, christian louboutin shoes, uggs on sale, ugg boots, louis vuitton outlet, chanel handbags, longchamp outlet, oakley sunglasses, nike outlet, louis vuitton, uggs outlet, polo outlet, michael kors outlet, burberry outlet, tiffany jewelry, michael kors outlet online, oakley sunglasses, nike air max, ugg boots, michael kors outlet online, oakley sunglasses, replica watches, nike free, michael kors outlet, replica watches, longchamp outlet, kate spade outlet

oakleyses said...

sac vanessa bruno, hollister uk, polo lacoste, vans pas cher, nike roshe run uk, nike free uk, true religion outlet, air max, polo ralph lauren, coach purses, louboutin pas cher, hollister pas cher, kate spade, lululemon canada, timberland pas cher, michael kors outlet, sac longchamp pas cher, michael kors pas cher, ray ban pas cher, true religion outlet, abercrombie and fitch uk, nike air max uk, replica handbags, nike air max uk, nike blazer pas cher, coach outlet, nike roshe, michael kors, mulberry uk, coach outlet store online, burberry pas cher, guess pas cher, nike air max, sac hermes, michael kors, north face uk, hogan outlet, north face, converse pas cher, oakley pas cher, ralph lauren uk, true religion outlet, new balance, jordan pas cher, nike free run, nike tn, longchamp pas cher, true religion jeans, nike air force, ray ban uk

oakleyses said...

hollister, north face outlet, mac cosmetics, baseball bats, nike huaraches, babyliss, new balance shoes, iphone cases, chi flat iron, louboutin, ferragamo shoes, iphone 5s cases, longchamp uk, soccer shoes, mcm handbags, nike roshe run, timberland boots, mont blanc pens, vans outlet, bottega veneta, instyler, oakley, ralph lauren, valentino shoes, giuseppe zanotti outlet, s6 case, p90x workout, celine handbags, iphone 6s plus cases, herve leger, north face outlet, nike trainers uk, ipad cases, iphone 6s cases, lululemon, wedding dresses, nike air max, abercrombie and fitch, nfl jerseys, hermes belt, insanity workout, ghd hair, asics running shoes, beats by dre, iphone 6 cases, reebok outlet, jimmy choo outlet, soccer jerseys, hollister clothing, iphone 6 plus cases

oakleyses said...

pandora jewelry, canada goose uk, canada goose, barbour, moncler, karen millen uk, swarovski crystal, replica watches, louis vuitton, canada goose, louis vuitton, juicy couture outlet, nike air max, lancel, swarovski, canada goose jackets, gucci, converse, thomas sabo, canada goose outlet, pandora charms, ugg,uggs,uggs canada, juicy couture outlet, doudoune moncler, hollister, moncler, montre pas cher, coach outlet, links of london, hollister, ugg uk, ugg, toms shoes, marc jacobs, pandora uk, vans, canada goose, moncler, canada goose outlet, moncler outlet, moncler outlet, louis vuitton, moncler, ray ban, louis vuitton, louis vuitton, converse outlet, moncler uk, ugg,ugg australia,ugg italia, supra shoes, barbour uk

Zheng junxai5 said...

zhengjx20160615
michael kors outlet clearance
louis vuitton handbags
michael kors handbags
longchamp outlet
michael kors bags
kate spade outlet
michael kors outlet clearance
nike air max uk
cheap toms
coach outlet
adidas stan smith
gucci outlet
michael kors outlet online
coach outlet online
toms outlet
coach outlet clearance
adidas originals
asics running shoes
adidas running shoes
ralph lauren
christian louboutin wedges
giuseppe zanotti outlet
michael kors purses
adidas wings
kobe 10
replica rolex watches
louis vuitton outlet online
jordan retro 11
replica watches
retro 11
toms wedges
michael kors outlet clearance
jordan 3 powder blue
true religion jeans
jordan retro 8
air jordan shoes
oakley vault
michael kors outlet clearance
nike uk
louis vuitton bags

Post a Comment

 
Copyright 2009 Spring vs Java EE Web Dev. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan