0

初始位置:

我们将 SEAM 与 RICHFACES 一起使用。

我们有以下页面配置和一个动作(称为 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

多谢。将是另一种方法。action 标签上的以下属性似乎解决了我的问题。希望没有副作用:

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

据我所知,你不能。将始终调用该操作。

与其使用页面操作,为什么不将 Backing Bean 限定为PAGECONVERSATION,然后从使用 注释的方法执行操作@Create?这将为您提供与页面操作相同的效果,但只会在第一次实例化 Bean 时调用。

于 2009-08-06T13:45:30.930 回答