Avoiding duplicate ids when reusing facelets compositions in the same naming container

Depending on the purpose of the <ui:include> template, you’ve several options: Use <f:subview>. It creates another NamingContainer context (like as <h:form>, <h:dataTable>, and friends all do): <f:subview id=”top”> <ui:include src=”https://stackoverflow.com/WEB-INF/includes/some.xhtml” /> </f:subview> … <f:subview id=”bottom”> <ui:include src=”https://stackoverflow.com/WEB-INF/includes/some.xhtml” /> </f:subview> The components definied in some.xhtml will end up getting respectively top: and bottom: prefix in their … Read more

Implementation difference between Aggregation and Composition in Java

Composition final class Car { private final Engine engine; Car(EngineSpecs specs) { engine = new Engine(specs); } void move() { engine.work(); } } Aggregation final class Car { private Engine engine; void setEngine(Engine engine) { this.engine = engine; } void move() { if (engine != null) engine.work(); } } In the case of composition, the … Read more