seam action method executed twice?
Pergunta
I'm currently working on a seam project and have a problem.
I just created a new page (an xhtml called MyPage.xhtml). In xhtml my code you can find a command button and a a:repeater to display my data:
<!-- input fields that are filters for my table shown below -->
<h:commandButton value="View details" action="/MyPage.xhtml"/>
<rich:panel rendered=#{myAction.showDetails}>
<a:repeat value="#{myAction.findRecords()}" var="record">
<!-- Some of my code to display a table, nothing fancy -->
</a:repeat>
</rich:panel>
in my action I have this:
@DataModel
private List<MyEntity> records = new ArrayList<MyEntity>();
public List<MyEntity> findRecords() {
//Do some query
Query query = entityManager.createNamedQuery("myEntityQuery");
records = query.getResultList();
return records;
}
This is how the page works:
- my input boxes and command button are shown, not the rich:panel as my showDetails boolean is false.
- When the showDetails boolean is set to true the panel is shown and the iterate calls my action method findRecords(). So far so good!
- But when I click my action button again the action method findRecords() is executed twice. And here's my problem...
Why should it be executed twice? How can I limit it to once? Now it costs us a lot of performance..!
Kr,
Dirk
Nenhuma solução correta
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow