0

初期位置:

SEAM と RICHFACES を併用しています。

ページの読み込み時に 1 回実行する必要があるアクション (actionBean.doBefore と呼ばれる) を含む次のページ構成があります。

<page>
  <action  execute="#{actionBean.doBefore}"/>
  <navigation from-action="#{actionBean.doAfter}">
    <redirect view-id="/view/component/test.xhtml" />
  </navigation>
</page>

問題

アクションは、ajax ごとにフィールドを検証するときにも実行されます。

<h:inputText value="#{formBean.price}" id="price" required="true">
  <a4j:support event="onblur" reRender="price" ajaxSingle="true" bypassUpdates="true" />
</h:inputText>

または提案ボックスを使用します(入力する場合でも):

<rich:suggestionbox id="suggestionBoxId" for="city" suggestionAction="#{suggest.autocomplete}" var="result" minChars="3" nothingLabel="No capitals found" ajaxSingle="true" bypassUpdates="true" selfRendered="true" >
  <h:column>
    <h:outputText value="#{result.cityName}" />
  </h:column>
</rich:suggestionbox>

前もってありがとう ラフィ

4

2 に答える 2

1

私の知る限り、あなたはできません。アクションは常に呼び出されます。

ページ アクションを使用する代わりに、Backing Bean のスコープをPAGEまたはCONVERSATIONに設定し、 で注釈が付けられたメソッドからアクションを実行してみ@Createませんか? これにより、ページ アクションと同じ効果が得られますが、Bean が初めてインスタンス化されたときにのみ呼び出されます。

于 2009-08-06T13:45:30.930 に答える
1

どうもありがとう。別のアプローチになります。アクションタグの次の属性は、私の問題を解決するようです。うまくいけば、副作用はありません:

<action  execute="#{actionBean.doBefore}" on-postback="false"/>
于 2009-08-06T16:14:12.573 に答える