【发布时间】:2015-07-16 20:20:18
【问题描述】:
我已经使用 Spring Security 设置了一个 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>
【问题讨论】:
-
你能在陈列柜上重现这个问题吗?如果没有,请发布MCVE 并尝试从开发人员的角度而非最终用户的角度详细说明问题。只要您实际上没有尝试过其他浏览器,请不要对浏览器做任何假设。
-
我确实将 PromieFaces 的版本更改为 5.2,并且浏览按钮确实更改为标准选择按钮。选择后,单个视图仍然不显示文件。 @BalusC
标签: jsf-2 primefaces