2012-07-12 20 views
0

我需要在fileUploadevent="uploadcomplete"之後調用checker()方法。如何在RichFaces中的event =「uploadcomplete」後執行操作<a4j:ajax>

public void checker() 
{fileProcessingEJB.checkInventoryToResolveAll();} 

下面的代碼沒有文件上傳,我需要在所有文件上傳完成後執行一些操作。我在<rich:fileUpload> </rich:fileUpload>之後這樣做了嗎?或者我可以撥打execute屬性中的方法<a4j:ajax>

<rich:fileUpload 
    fileUploadListener="#{fileUploadBean.listener}" 
    id="upload" acceptedTypes="xml" 
    ontyperejected="alert('Only XML files are accepted');" 
    maxFilesQuantity="50"> 
<a4j:ajax event="uploadcomplete" execute="#@none" render="info" /> 
</rich:fileUpload> 

回答

2

看看這個Thread

您可以使用監聽像下面。

<rich:fileUpload id="generic_data_file" fileUploadListener="#{controller_bean.uploadFile}" 
    <a4j:support event="onuploadcomplete" actionListener="#{controller_bean.loadInfoFileHook}"/> 
</rich:fileUpload> 

如果你想做任何你可以在actionListener做的動作。

或者

如果你想顯示一條消息

,看看這個Issue thread(取決於您的版本)

+0

感謝提示使用'actionListener',因爲我使用RichFaces的4.2 .2最後,它是''。 – shaz 2012-07-12 11:56:28