File upload fileUploadListener:prime面对fileUploadListener不';不要调用该方法
我正在用PrimeFaces 4.0.RC1开发一个web应用程序,我在文件上传方面有问题 完全使用fileUploadListener;此侦听器不调用“handleFileUpload”方法 当我尝试使用commandButton调用此方法时:commandButton中的操作工作正常 这是my web.xml的pert:File upload fileUploadListener:prime面对fileUploadListener不';不要调用该方法,file-upload,File Upload,我正在用PrimeFaces 4.0.RC1开发一个web应用程序,我在文件上传方面有问题 完全使用fileUploadListener;此侦听器不调用“handleFileUpload”方法 当我尝试使用commandButton调用此方法时:commandButton中的操作工作正常 这是my web.xml的pert: <!-- Filter for the JSF uploder --> <context-param> <param-name>
<!-- Filter for the JSF uploder -->
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>facesServlet</servlet-name>
</filter-mapping>
这是我在堆栈溢出中的第一个问题,希望您能帮助我:),很简单:D,当您在web.xml中使用漂亮的面孔添加前向过滤器映射时;)PrimeFaces文件上传过滤面Servlet FORWARD我希望这对某人有所帮助:D
<h:form enctype="multipart/form-data">
<p:growl id="kpiUploadNote" showDetail="true" sticky="true" />
<!-- Test with advanced fileUpload -->
<p:fileUpload
fileUploadListener="#{fileUploadController.handleFileUpload}"
mode="advanced" dragDropSupport="false" sizeLimit="100000"
update="kpiUploadNote" fileLimit="3" allowTypes="/(\.|\/)(csv|xlsx)$/" />
<!-- Test with commandButton to test the bean -->
<p:commandButton action="#{fileUploadController.handleFileUpload}"
update="kpiUploadNote" ajax="false" />
</h:form>
@Scope
@ManagedBean(name = "fileUploadController")
public class FileUploadController {
public void handleFileUpload(FileUploadEvent event) {
System.out.println("calling file upload...");
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
public void handleFileUpload() {
FacesMessage msg = new FacesMessage("Succesful", " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}