2015-09-15 14 views
0

我有一個A4J一個問題:jsFunction(下面的代碼片段):不叫上A4J託管bean:jsFunction

<a4j:jsFunction 
name="updateVal" 
render="panelViewStation" 
execute="@all" 
onbegin="alert('begin');" 
onbeforedomupdate="alert('onbeforedomupdate')" 
oncomplete="alert('complete');" 
action="#{controller.aMethod}" 
actionListener="#{controller.anotherMethod}" 
onerror="alert('error');"> 
    <a4j:param name="val" assignTo="#{controller.val}"/> 
</a4j:jsFunction> 

在我管理的bean,我有以下方法:

/** action method */ 
public Object aMethod() { 
    return "something"; 
} 

/** action listener method */ 
public void anotherMethod(ActionEvent actionEvent) { 
    // do something 
} 

// get/setter for val 

此方法由以下另一個js函數調用:

function processSelectEvent(target) { 
    alert(target.previousElementSibling.textContent); 
    updateVal(target.previousElementSibling.textContent); 
} 

並且最後該方法由自動完成元素調用

<rich:autocomplete id="stationId" minChars="3" var="station" inputClass="autoCompleteWidth300" onselectitem="processSelectEvent(event.target);" 
        fetchValue="#{station.name}" 
        autocompleteMethod="#{controller.searchStations}" 
        mode="cachedAjax" required="true" autofill="false" layout="table"> 

不幸的是,該功能並不如預期。 當我在自動完成列表中選擇一個元素時,函數processSelectEvent被調用。 調用js函數「updateVal」,但只調用「onbegin」javascript。 其他屬性不會被調用(onbeforedomupdate,oncomplete,onerror),託管bean也不會被調用(action,actionListener)。

任何想法解決我的問題? Thx

+0

在控制檯中看到的任何錯誤?你使用什麼RichFaces版本? – Makhiel

+0

@ Makhiel。我使用RF4。服務器控制檯沒有錯誤。 a4j:日誌中沒有錯誤。我唯一看到的是服務器發送部分更新(),但在頁面的另一部分 – djschorn

+0

@Makhiel我放了一個相位跟蹤器,所有階段都實現了(no驗證階段出錯) – djschorn

回答