【问题标题】:icefaces 3 fileEntry fileEntryListener not getting called on h:commandButtonicefaces 3 fileEntry fileEntryListener 未在 h:commandButton 上被调用
【发布时间】:2012-12-16 13:47:42
【问题描述】:

我正在使用 icefaces 3。我的问题是我有一个 ace:fileEntry,它有一个 fileEntryListener。我有一个 h:commandButton,它在我的表单末尾设置了一个 actionListener。当我点击我的 commandButton 时,我注意到只有我的按钮的 actionListener 被调用,但 fileEntryListener 没有被完全调用。我的意思是文件被上传到临时位置,但我在 fileEntryListerner 中的实际代码没有被调用。 我在我的 fileEntryListerner 中编写了一个客户逻辑,将上传的文件复制到另一个位置,但这不起作用。下面是我的代码。谁能解释一下为什么 fileEntryListner 代码不能完全工作。

            <td>
                <ace:fileEntry id="file-entry" label="Attachment"
                    absolutePath="/STR_UPLOADED_FILES"
                    maxFileCount="1" 
                    maxFileCountMessage="Limited to 1 files uploaded concurrently." 
                    fileEntryListener="#{strformbean.fileuploadListener}"
                    maxFileSize="6291456" 
                    maxFileSizeMessage="Submitted file is too large.Max size allowed is 6MB" 
                    maxTotalSize="6291456" 
                    maxTotalSizeMessage="Total size of submitted files is too large." 
                    required="false" 
                    requiredMessage="The file is required to submit this form." 
                    useOriginalFilename="false"  
                    useSessionSubdir="false"  />

            </td>
            <td colspan="2"  class="sectionHeader"  align="center"> 
                <h:commandButton id="submitM" type="submit" value="SAVE" action="strform" actionListener="#{strformbean.saveSTR}"/> 
            </td>


public void fileuploadListener(FileEntryEvent e)throws Exception {
    log.info("Inside fileuploadListener started....");
    FileEntry fe                = (FileEntry)e.getComponent();
    FileEntryResults results    = fe.getResults();
    File parent                 = null;
    ArrayList fileData          = new ArrayList<String>

............

上面的记录器信息行根本不打印,但文件已上传。

【问题讨论】:

  • 我使用 FileEntryResults 对象在我的 actionListener 中获取有关文件的文件详细信息,然后我编写了我的序列化代码。

标签: jsf-2 icefaces-3


【解决方案1】:

尝试删除 h commandButton 上的动作和动作监听器。希望这行得通。

【讨论】:

  • 可以在这方面使用更多细节。
【解决方案2】:
Try using <h:form> instead of <ice:form> as your form tag

Also <h:commandButton> should not include "action" or "actionListener" attributes.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-13
    • 2016-07-26
    • 2011-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-11
    相关资源
    最近更新 更多