Lately I wanted to use ui:include to read some common form fields from a seperate. I had a stumbling block, though, because I was using Apache Trinidad’s tr:panelFormLayout, which only lays out its direct children (or children in a group, but that results in a different look).
Although I’ve since given up on using trinidad, I had an idea on how to get around this – use c:if. As far as I know, c:if doesn’t create an additional component, so its inner components are added to the parent. I think ui:include might not require the incuded file to be valid XML – I could leave out the c:if and have multiple roots – but I prefer to have the file look like valid xml for the benefit of other tools.
So, the target file of the include would look like this:
<c:if test="true" xmlns:...> ... </c:if>