![](/img/trans.png)
[英]FileDownload and FileUpload JSF Primefaces not working
[英]fileUpload not working in primefaces wizard
在p:wizard中,我在第一个选项卡中上传了文件。当我移到下一个选项卡时,上传的图片变空。如何解决此问题,请在第一个选项卡中设置图片。请任何人帮助我...... ....
<p:wizard>
<p:tab id="tabbranch" title="Branch" titleStyle="font-size:14px;">
<p:panel id="display" >
<h:panelGrid columns="2">
<h:outputLabel value="Branch File"
style="text-align: left;display: block;width:120px"/>
<p:fileUpload value="#{branchBean.current.buildingPlan}"
allowTypes="*.jpg;*.png;*.gif;" mode="simple" style="width:185px"/>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab title="Profile page 1" titleStyle="font-size:14px;">
<p:panel>
<h:outputLabel value="Name:*" style="text-align: left;display: block;width:130px;"/>
<p:inputText value="#{branchBean.current.branchName}"
readonly="#{searchBean.selectedCustomer.editAccess}"
style="width:170px;" />
</p:panel>
</p:tab>
</p:wizard>
从PrimeFaces用户指南3.5( http://primefaces.googlecode.com/files/indexed_primefaces_users_guide_3_5.pdf ):
1)将以下库添加到您的项目中:commons-fileupload 1.2.1和commons-io 1.4;
2)在您的web.xml中映射以下过滤器:
<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>
在《 Primefaces用户指南》中未作解释:
1)将h:form配置为multipart / form-data
<h:form enctype="multipart/form-data">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.