My code here iterates the columns for each row and the rendered attribute is calculated every iteration, overcalling testRule.
<p:dataTable ...>
<p:column ...>
...
</p:column>
<p:column rendered="#{managedBean.testRule('rules.canDoActions')}">
<!-- Action buttons -->
<h:commandButton ...>
<h:commandButton ...>
</p:column>
</p:dataTable>
To get better performance, I was wondering to set the result into a variable, but I don’t know how… It would become something like this:
<?:??? var="canDoActions" value="#{managedBean.testRule('rules.canDoActions')}">
<p:dataTable ...>
<p:column ...>
...
</p:column>
<p:column rendered="#{canDoActions}">
<!-- Action buttons -->
<h:commandButton ...>
<h:commandButton ...>
</p:column>
</p:dataTable>
Also, I’m not allowed to use Core Tag Library, wich means that <c:set ../> is out of question.
In that scope, how could I set a variable? Or, if not possible, what do you suggest to solve the performance?
Then you can have it stored on Bean itself and check if it is null calculateRules and set value or simply return.
For Example: