Jin
Jin

Reputation: 77

JSF ui:include downside

I have this web application and one of the module use an excessive amount of ui:include.

ex.

page 1.0 include --> page1.1 include page 2.0 include --> page 2.1
page 1.0 include --> page1.2 include page 3.0 include --> page 3.1
page 1.0 include --> page1.3 include page 4.0 include --> page 4.1

and so on..

so in short the landing page of that module has 16 ui:include and almost every ui:include has a another ui:include in it (up to 3 layers).

Now my question is, are there any known performance issue using to much ui:include?

Thanks,

Upvotes: 2

Views: 1046

Answers (2)

Adam
Adam

Reputation: 3795

If some included components are only shown conditionally, then wrap them in an outputPanel with a rendered attribute that is tied with their display. Something like the following for each include that is conditionally viewed.

<a4j:outputPanel rendered="#{myBean.showInclude2}">
    <ui:include src="page2.0.xhtml" />
</a4j:outputPanel>

Assumptions about not all components being needed based on comments in Rafael's answer

Upvotes: 0

Lyrion
Lyrion

Reputation: 426

My guess is it has the same performance as just taking all the pages and putting them all together into one page. Since that's what an include does, if you have a page you repeat in other pages, then its just easyer to make one page and include it in the others.

The include just makes the pages easyer to configure and look at i guess

Upvotes: 3

Related Questions