Reputation: 123
For a web application (myfaces 2.2), I need to reduce the component tree to speed up the application. How can I do this?
given:
a composite component that renders input elements due to a backing bean value
<h:dataTable value="#{myList}" var="myBean">
<h:column>
<h:inputText ... rendered="#{myBean.myValue == 1}" />
<h:selectOneMenu ... rendered="#{myBean.myValue == 2}">...</...>
<h:inputTextarea ... rendered="#{myBean.myValue == 3}" />
</h:column>
</h:dataTable>
problem:
all components appear in component tree, even when their rendered attribute is false
Is it possible to forbid JSF to build up the component tree with all three components? The restore view phase doesn't know about content of the apply request values phase, but it would be important to be able to interpret it still before.
Upvotes: 0
Views: 342
Reputation: 578
If you want to achieve this behavior, try to use <c:if>
tag instead of rendered atribute on JSF component
<c:if test="#{ myBean.myValue == 1 }">
<h:inputText .../>
</c:if>
don't forget to add namespace definition
xmlns:c="http://java.sun.com/jstl/core"
Upvotes: 1