【发布时间】:2014-09-26 14:01:54
【问题描述】:
我有这样的事情:
<h:form id="form">
<p:fileUpload fileUploadListener="#{jSFmanageBean.fileUpload}"
update="gallery"
mode="advanced"
auto="true"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
<p:dataGrid var="car"
value="#{jSFmanageBean.cars}"
id="gallery" >
<p:panel header="#{car.id}"
style="text-align:center"
id="testSomething">
<p:graphicImage alt="ERROR2"
value="#{jSFmanageBean.image2}"
width="250">
<f:param name="id" value="#{car.id}" />
</p:graphicImage>
</p:panel>
</p:dataGrid>
<p:commandLink update=":form:carDetail"
oncomplete="PF('carDialog').show()"
title="View Detail">
<h:outputText styleClass="ui-icon ui-icon-search"
style="margin:0 auto;" />
<f:setPropertyActionListener value="#{car}"
target="#{jSFmanageBean.selectedCar}" />
</p:commandLink>
<p:dialog header="Car Info"
widgetVar="carDialog"
modal="true"
showEffect="fade"
hideEffect="fade"
resizable="false">
<p:outputPanel id="carDetail"
style="text-align:center;">
<p:panelGrid columns="2"
rendered="#{not empty jSFmanageBean.selectedCar}"
columnClasses="label,value">
<h:outputText value="Id:" />
<h:outputText value="#{jSFmanageBean.selectedCar.id}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
问题是当我尝试使用“p:commandLink”时“p:fileUpload”组件被触发(或类似的东西)并且我有错误。
Warning: javax.servlet.ServletException: The request content-type is not a multipart/form-data
javax.faces.FacesException: javax.servlet.ServletException: The request content-type is not a multipart/form-data
at org.primefaces.component.fileupload.NativeFileUploadDecoder.decode(NativeFileUploadDecoder.java:44)
at org.primefaces.component.fileupload.FileUploadRenderer.decode(FileUploadRenderer.java:44)
.
.
.
Caused by: javax.servlet.ServletException: The request content-type is not a multipart/form-data
.
.
当我以相同的形式使用其他 ajax 东西时,如何防止触发 FileUpload?
【问题讨论】:
标签: java ajax jsp primefaces