1

我正在使用icefaces 3。我的问题是我有一个ace:fileEntry,它有一个fileEntryListener。我有一个 ah: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>

…………

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

4

2 回答 2

0

尝试删除 h commandButton 上的操作和操作侦听器。希望这有效。

于 2013-02-22T22:24:57.863 回答
0
Try using <h:form> instead of <ice:form> as your form tag

Also <h:commandButton> should not include "action" or "actionListener" attributes.
于 2013-04-16T22:07:20.697 回答