PrimeFaces两个fileUpload控件运行冲突

时间:2013-04-22 09:01:53

标签: java jsf-2 primefaces

我有一个包含两个fileUpload控件的页面:

<h:panelGroup id="distinctAttachmentsPanel" rendered="#{multipleSendingController.selectedAttachmentList == 2}">
<h:outputText value="Allegati distinti" />
  <p:fileUpload id="distinctFileUpload" fileUploadListener="#{multipleSendingController.onDistinctFileUpload}"
    mode="advanced"
    multiple="true"
    sizeLimit="100000000"
    label="Sfoglia"
    uploadLabel="Carica"
    cancelLabel="Annulla"
    update=":form:uploadedDistinctFiles" />
  <p:selectManyCheckbox id="uploadedDistinctFiles" value="#{multipleSendingController.selectedDistinctAttachments}" converter="#{multipleSendingController.fileConverter}" layout="pageDirection">
    <f:selectItems value="#{multipleSendingController.distinctAttachments}" var="a" itemLabel="#{a.name}" itemValue="#{a}" />  
  </p:selectManyCheckbox>
  <h:outputText value="File excel" />
  <p:fileUpload id="excelFileUpload" fileUploadListener="#{multipleSendingController.onExcelFileUpload}"
    mode="advanced"
    multiple="true"
    sizeLimit="100000000"
    label="Sfoglia"
    uploadLabel="Carica"
    cancelLabel="Annulla"
    update=":form:uploadedExcelFiles" />
  <p:selectManyCheckbox id="uploadedExcelFiles" value="#{multipleSendingController.selectedExcelFiles}" converter="#{multipleSendingController.fileConverter}" layout="pageDirection">
    <f:selectItems value="#{multipleSendingController.excelFiles}" var="a" itemLabel="#{a.name}" itemValue="#{a}" />  
  </p:selectManyCheckbox>
</h:panelGroup>

当我在一个fileUpload控件中选择一个或多个文件时,相同的文件会出现在另一个控件中,就像它在那里被选中一样。 我无法弄清楚出现了什么。

1 个答案:

答案 0 :(得分:0)

你应该将每个fileUpload放在一个单独的h:form