FileUpload标签未在浏览器中呈现

时间:2019-05-13 12:28:58

标签: file-upload primefaces

我正在将Primefaces版本从4.0.RC1迁移到6.2,并且fileupload标签不再显示在表单上

我的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>

我的test.xhtml部分

<h:form prependId="false" id="form1" enctype="multipart/form-data">
<p:outputLabel value="Arquivo: " for="fileUpload" />
<p:fileUpload id="fileUpload" fileUploadListener="#{CtPessoaSB.handleFileUpload}" label="Escolher" uploadLabel="Enviar" cancelLabel="Cancelar" />
</h:form>

1 个答案:

答案 0 :(得分:0)

我通过将jsf版本升级到2.2解决了该问题。 在pom.xml部分之下

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<version>2.2.14</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>