PrimeFaces:文件上传视图未更新

PrimeFaces: File Upload View Not Updating

我已经使用 spring 安全设置了一个 JSF 项目。我试图让 FileUpload PrimeFaces 在用户浏览完文件后显示所选文件。

我正在使用:

http://www.primefaces.org/showcase/ui/file/upload/single.xhtml

问题是在选择文件后,视图中没有显示任何内容,上传按钮也不会突出显示。有什么帮助吗? 我确实尝试了基本文件上传,它确实更新了视图中的文件名

基本视图 http://www.primefaces.org/showcase/ui/file/upload/basic.xhtml

莫非我用的是v31.0的FireFox版本?

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:b="http://bootsfaces.net/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>

</h:head>

<h:body>

<h:form enctype="multipart/form-data">
  <p:growl id="messages" showDetail="true" />
  <p:fileUpload value="#{fileUploadController.file}" mode="simple"     skinSimple="true"/>
  <p:commandButton value="Submit" ajax="false" actionListener="#{fileUploadController.upload}" disabled="false" />
</h:form>

<h:form enctype="multipart/form-data">
  <p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}" mode="advanced" dragDropSupport="false"
       update="messages" sizeLimit="100000" fileLimit="3" allowTypes="/(\.|\/)(txt|gif|jpe?g|png)$/" />
   <p:growl id="messages" showDetail="true" />
</h:form>

</h:body>
</html>

我的 web.xml 中也有这个:

<!-- PrimeFaces Client Side Validation -->
<context-param>
 <param-name>primefaces.CLIENT_SIDE_VALIDATION</param-name>
 <param-value>true</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>Faces Servlet</servlet-name>
</filter-mapping>

POM:

    <!-- PrimeFaces -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.2</version>
        <scope>compile</scope>
    </dependency>

我之前遇到过类似的问题。 当您定义文件上传组件时,请确保文件上传组件是唯一的。从您的 javaBeans 获取 id。

关于文件名,这是一个CSS的问题。 如果您打开检查器并逐层挖掘 <tb> 标签,您应该会看到文件的名称。调整您的 CSS 以使名称可见。