2009-08-05 55 views
0

初始位置禁用操作執行:如何在Ajax請求

我們正在使用煤層RichFaces的一起。

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

問題

即使執行該操作:

我們得到了以下頁面配置與動作(稱爲actionBean.doBefore),應一次在頁面加載執行當我們驗證每場阿賈克斯:

<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> 

在此先感謝 拉菲

回答

1

據我知道你不能。該行爲將始終被調用。

而不是使用頁面動作你爲什麼不範圍支持bean來PAGE交談,然後執行從@Create註釋的方法的動作?這會給你與頁面動作相同的效果,但只會在Bean第一次被實例化時調用。

1

非常感謝。將是另一種方法。 action標籤上的下列屬性似乎解決了我的問題。希望沒有副作用:

<action execute="#{actionBean.doBefore}" on-postback="false"/>