javax.el.MethodNotFoundException 与 ace:fileEntry 组件

发布于 2024-12-17 05:17:39 字数 1489 浏览 3 评论 0原文

我正在尝试使用 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 ########");
            }
        }
    }

Exception:

javax.el.MethodNotFoundException: /uploadFiles.xhtml @32,81 action="#{userBean.uploadFile}": Method not found: [email protected]()

在这种情况下如何设置方法? 有人会告诉我,xhtml 页面中的方法调用应该采用 bean 中的参数,但我会回答我按照此处示例中提到的那样进行操作:

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

请告知。

i am trying to use ace:fileEntry component to upload files
but i am keep getting errors that action method doesn't exist
here's what i am trying:

1- ace:fileEntry component

<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 ########");
            }
        }
    }

Exception:

javax.el.MethodNotFoundException: /uploadFiles.xhtml @32,81 action="#{userBean.uploadFile}": Method not found: [email protected]()

how to set the method in this case ?
someone will tell me that the method call in xhtml page should take a parameter as in the bean, but i will answer that i did as mentioned in the example here:

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

please advise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

未蓝澄海的烟 2024-12-24 05:17:39

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

problem was that i was using action method with the command button which is not necessary, i just needed to add command button with no action, everything works fine now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文