【发布时间】:2018-02-21 13:03:30
【问题描述】:
我正在尝试在 p:dialog 中使用 PrimeFaces p:fileUpload 上传文件,但它不起作用
<h:form id="form3">
<p:commandLink value="upload" oncomplete="PF('Dialog').show()" />
<p:dialog widgetVar="submitDialog" modal="true" >
<h:form id="form" enctype="multipart/form-data" >
<h:panelGrid id="submitPanelGrid" columns="2" >
<p:fileUpload id="upload" value="#{bean.file}" mode="simple" sizeLimit="100000" />
<p:commandButton id="btn3" action="#{bean.submit()}" icon="ui-icon-circle-check" ajax="false" />
</h:panelGrid>
</p:panel>
</h:form>
</p:dialog>
</h:form>
点击链接后,我得到了这个异常:
org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException:请求不包含 multipart/form-data 或 multipart/mixed 流,
内容类型标头为 application/x-www-form-urlencoded;
但是在<p:dialog>之外,它工作得很好。
【问题讨论】:
-
您是否尝试在表单中指定多部分?例如:
-
是的,我试过了,但没用
-
html(和 jsf)中不允许嵌套表单
标签: jsf file-upload primefaces dialog