s:fileUpload not actually sending output?
rjstanford Oct 2, 2007 10:02 AMI've been struggling with getting s:fileUpload to work with our application; from reading the message boards it seems as if we're doing everything right, but obviously something's missing. This is with Seam 2.0.0.B1, fwiw.
Our components.xml file contains:
<web:multipart-filter create-temp-files="false" max-request-size="1000000"/>
Our web.xml file is, in its entirety:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <distributable /> <display-name>Control Panel</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-mapping> <listener> <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> </listener> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>plain</param-value> </context-param> <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value>/WEB-INF/components/core.taglib.xml;/WEB-INF/domain/core.taglib.xml</param-value> </context-param> <filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter> <filter-name>Seam Redirect Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class> </filter> <filter> <filter-name>Seam Exception Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Seam Exception Filter</filter-name> <url-pattern>*.xhtml</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Seam Redirect Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>richfaces</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
Within the page template, we're using this to create the form:
<h:form id="main" styleClass="k_main clearfix" enctype="multipart/form-data">
And finally, in the page itself, we're using the tag as follows:
<s:fileUpload id="picture" data="#{campaign.logo}" contentType="#{campaign.logoType}" fileName="#{campaign.logoFileName}"/>
All I really care about is the data stream - I've tried adding and removing contentType, accepts, et cetera. In the bean, the fields are defined as follows:
private byte[] logo; private String logoType; private String logoFileName; ..... @Lob @Column(length = 1048576) public byte[] getLogo() { return logo; } public void setLogo(byte[] logo) { this.logo = logo; } @Transient public String getLogoType() { return logoType; } public void setLogoType(String logoType) { this.logoType = logoType; } @Transient public String getLogoFileName() { return logoFileName; } public void setLogoFileName(String logoFileName) { this.logoFileName = logoFileName; }
Interestingly, breakpoints on the set methods show that setLogo() is called with a null value, but that setLogoFileName() et al are never called. So we're obviously missing something in the configuration. Any help will be greatly appreciated.