Yes, it will. The UIComponent#encodeAll()
will check if isRendered()
returns true
before continuing with encoding itself and its children.
On the other hand, this suggests that you're performing business logic in the getter of the <f:selectItems>
. Otherwise, you wouldn't worry about it at all for the case it returns null
or so and never have asked this question in first place. The getter method is the wrong place for performing business logic. You should do that in the (post)constructor or (action)listener method instead. The getter should solely return the already-prepared value.
Thus, this is wrong:
public boolean isShouldRender() {
boolean shouldRender = // Some business logic...
// ...
return shouldRender;
}
public List<Agent> getAllAgents() {
List<Agent> allAgents = // Some business logic...
// ...
return allAgents ;
}
Instead, you should do
// Have properties which you initialize during an event.
private boolean shouldRender;
private List<Agent> allAgents;
public void someEventMethod() { // E.g. postconstruct, action, ajax behavior, value change, etc.
shouldRender = // Some business logic.
allAgents = // Some business logic.
}
// Keep the getters untouched!
public boolean isShouldRender() {
return shouldRender;
}
public List<Agent> getAllAgents() {
return allAgents;
}
See also: