使用<s:fileUpload>
组件进行文件上传时返回null。
应用程序使用seam 2.1.2与Richfaces集成,Jsf
<h:panelGrid columns="2" cellspacing="1" cellpadding="0"
columnClasses="columnFull">
<s:fileUpload id="picture" data="#{image.uploadedFile}"
contentType="#{image.pictureContentType}" />
</h:panelGrid>
@Name("image")
@Scope(ScopeType.CONVERSATION)
public class DoImportServiceUpload {
@Lob
@Column(length = 2147483647)
private byte[] uploadedFile;
private String pictureContentType;
}
的web.xml
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
的components.xml
<web:multipart-filter create-temp-files="true"
max-request-size="1000000"
url-pattern="*.seam" />
答案 0 :(得分:2)
s:fileUpload
标记是否实际包含在单个h:form
中。 h:form
应为<h:form enctype="multipart/form-data">
类型。检查这是否也在HTML输出中正确呈现。