私は現在シームプロジェクトに取り組んでおり、問題があります。
新しいページ(MyPage.xhtmlというxhtml)を作成しました。xhtml my codeには、データを表示するためのコマンドボタンとaa:repeaterがあります。
<!-- 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>
私の行動ではこれがあります:
@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;
}
ページの仕組みは次のとおりです。
- showDetailsブール値がfalseであるため、rich:panelではなく、入力ボックスとコマンドボタンが表示されます。
- showDetailsブール値がtrueに設定されている場合、パネルが表示され、反復によってアクションメソッドfindRecords()が呼び出されます。ここまでは順調ですね!
- しかし、アクションボタンをもう一度クリックすると、アクションメソッドfindRecords()が2回実行されます。そして、これが私の問題です...
なぜ2回実行する必要があるのですか?どうすれば1回に制限できますか?今では多くのパフォーマンスが必要です。
Kr、
ダーク