I have a primefaces wizard containing a ui:repeat
, as follows:
<p:wizard flowListener="#{reportWizard.onFlowProcess}" widgetVar="wiz" showStepStatus="false" showNavBar="false">
<p:tab id="problem" title="Problem">
<p:panel header="What's the problem?" styleClass="wizardPanel">
<p:messages />
<h:panelGrid width="100%" columns="1">
<ui:repeat value="#{incidentData.incidentTypes}" var="incidentTypes">
<p:commandButton process="@this" value="#{incidentTypes.name}" actionListener="#{reportWizard.evalProblemType}" onclick="PF('wiz').next();" styleClass="ui-priority-primary" />
</ui:repeat>
</h:panelGrid>
</p:panel>
</p:tab>
// ... more tabs ...
</p:wizard>
Basically, I'm just getting commandButton
titles out of my database via
#{incidentData.incidentTypes}
.
Previously, I had a static list of commandButton
s, and it worked fine, but now that I'm using ui:repeat
, it makes the page very slow (each step of the wizard takes a second or two to respond). For some reason, getIncidentTypes()
is called several times when the wizard advances through each step, even though the buttons are only in the first step of the wizard, and the query should only be run once. Why is this?
Is this not the correct way to have database-driven buttons? What can I do to fix this? Thanks.