![](/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.