带有ace:fileEntry组件的javax.el.MethodNotFoundException

时间:2011-11-17 19:22:06

标签: jsf-2 el icefaces

我正在尝试使用 ace:fileEntry 组件上传文件 但我不断得到行动方法不存在的错误 这是我正在尝试的:

1- ace:fileEntry组件

<h:form>
        <ace:fileEntry id="fileEntryComp"
               label="File Entry"
               relativePath="uploaded"
               fileEntryListener="#{userBean.uploadFile}"/>



        <h:commandButton value="Upload File" action="#{userBean.uploadFile}"/> 



</h:form>

2- UserBean:

public void uploadFile(FileEntryEvent event) {
        FileEntry fileEntry = (FileEntry) event.getSource();
        FileEntryResults results = fileEntry.getResults();
        for (FileEntryResults.FileInfo fileInfo : results.getFiles()) {
            if (fileInfo.isSaved()) {
                log.debug("########### FILE IS SAVED ########");
            }
        }
    }

例外:

javax.el.MethodNotFoundException: /uploadFiles.xhtml @32,81 action="#{userBean.uploadFile}": Method not found: com.myapp.beans.UserBean@2b066718.uploadFile()

在这种情况下如何设置方法? 有人会告诉我xhtml页面中的方法调用应该采用bean中的参数,但我会回答我在这里的例子中提到的那样:

http://wiki.icefaces.org/display/ICE/FileEntry

请告知。

1 个答案:

答案 0 :(得分:0)

问题是我使用了命令按钮的动作方法,这是不必要的,我只需要添加命令按钮而不需要动作,现在一切正常。

相关问题