我上運行的Web應用程序:文件上傳不PrimeFaces 4.0,JSF鑽嘴魚科2.2.3和Wildfly貝塔工作1
- Wildfly Beta 1的
- JSF鑽嘴魚科2.2.3(從Wildfly )
- Primefaces 4.0
- rewrite-servlet-2.0.7.Final/rewrite-config-prettyfaces-2.0.7.Final
- 公地-IO-2.4 /公地文件上傳-1.3
和我有文件上傳組件問題(高級和簡單模式不工作,從不打印裏面上傳())。
即使沒有rewrite-servlet-2.0.7.Final/rewrite-config-prettyfaces-2.0.7.Final庫,也是如此。
我upload.xhtml文件:
<h:form prependId="false" id="formLateralUpload" enctype="multipart/form-data">
<h:panelGrid columns="1" cellpadding="5">
<p:fileUpload mode="advanced" multiple="true" update="@widgetVar(msg)"
fileUploadListener="#{test.upload}" auto="true" sizeLimit="10500000"/>
</h:panelGrid>
</h:form>
我的豆:
@ManagedBean(name = "test")
@ViewScoped
public class Test {
private UploadedFile file;
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void upload(FileUploadEvent event) {
System.out.println("inside upload()");
}
}
的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="test"
version="3.1">
<display-name>test</display-name>
<welcome-file-list>
<welcome-file>/</welcome-file>
</welcome-file-list>
<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>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/redirect</location>
</error-page>
</web-app>
您是否在IDE或瀏覽器控制檯中看到錯誤?隨着你發佈的代碼看起來非常簡單,所以當你實現相同的代碼應該工作。 – SRy
Nothing :)只有我能從JS控制檯得到的是:_ <?xml version ='1.0'encoding ='UTF-8'?>><![CDATA [3007632957922009037:-9144340151501339861]]> partial-response> _ –
Domen91
今天我測試了一個空白web項目,只有apache libs和PF lib,結果:( – Domen91