Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File upload Primefaces p:文件上载不工作_File Upload_Jsf 2_Primefaces - Fatal编程技术网

File upload Primefaces p:文件上载不工作

File upload Primefaces p:文件上载不工作,file-upload,jsf-2,primefaces,File Upload,Jsf 2,Primefaces,我将Primefaces4.0与JSF2.0结合使用,我知道Primefaces的一些基础知识。 对我来说,p:fileUpload不工作,它以前工作过。不知道发生了什么 当我从文件选择器中选择任何文件时,p:fileUpload的文件面板中没有填充任何文件 这是我的密码: <p:panel style="font-size:15px;" header="Upload"> <p:fileUpload fileUploadListener="#{addAgentxls

我将Primefaces4.0与JSF2.0结合使用,我知道Primefaces的一些基础知识。 对我来说,
p:fileUpload
不工作,它以前工作过。不知道发生了什么 当我从文件选择器中选择任何文件时,p:fileUpload的文件面板中没有填充任何文件

这是我的密码:

<p:panel style="font-size:15px;" header="Upload"> 
    <p:fileUpload  fileUploadListener="#{addAgentxls.handleFileUpload}" mode="advanced" dragDropSupport="true"
                   update="messages status" sizeLimit="100000"  style="font-size:12px;" />
    <p:growl id="messages" showDetail="true"/>
    <p:outputLabel id="status" style="font-size:13px;"  value="#{addAgentxls.status }"/>
</p:panel>
web.xml:

<!-- File Uploading Constraints -->
<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>Faces Servlet</servlet-name>
</filter-mapping>

它值得吗?

解决了!我使用的是新版本的<代码> jQuery .js>代码>,它与<代码> PrimeFrase>代码>

< P> >请考虑下面的堆栈溢出链接的建议。


同样的问题。jQuery(“.primeFacesHiddenAwayButton type=['file']”)。click()在IE和firefox上都运行良好(由于Selenium驱动程序的限制,我的firefox不是最新版本)。无论如何,在chrome中,JS按钮根本不起作用。显然,这是浏览器内置的安全功能。您可以在提供的链接上尝试该建议。

我不确定您是否已将enctype=“multipart/form data”添加到表单中。是的,该面板添加在h:formReference@psi中,感谢链接帮助BalusC值得,我使用的是较新版本的jQuery.js
<!-- File Uploading Constraints -->
<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>Faces Servlet</servlet-name>
</filter-mapping>
Uncaught TypeError: Object [object Object] has no method 'fileupload' 
fileupload.js.xhtml?ln=primefaces&v=4.0:1