s:fileUpload does not work in SEAM 2.2.0
mayliu3 Jun 7, 2012 11:03 AMNewbie here. Search through the Internet and could not find any helpful answer yet..
I have tried to implement a simple file upload functionality. We use JBOSS 5.0.1 and SEAM 2.2.0
First I tried <s:fileUpload> tag follow the documentation of SEAM 2.2.0. However, the upload file is always null. I have set break point in the FileUploadRederBase.doDecode() and find the request was not treaded as MultipartRequest. Could not figure out why? Does <s:fileUpload> real works for SEAM2.2.0 and JBOSS 5.0.1.
Here is the related code:
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>
---------------------------------------------------------------
Component.xml:
<component class="org.jboss.seam.web.MultipartFilter">
<property name="createTempFiles">false</property>
--------------------------------------------------------------------
BRFileUpload.xhtml
<rich:panel style="border-style : none;" headerClass="title-section">
<h:panelGrid columns="1" width="50%">
<h:form id="fileULForm" enctype="multipart/form-data">
<s:fileUpload styleClass="submit_button_small_upload"
id="lqgFile" data="#{bRFileController.upLoadFile}"
fileName="#{bRFileController.upLoadFileName}"
contentType="#{bRFileController.fileContentType}" />
<h:commandButton value="Import LQG Files"
styleClass="submit_button_small_white"
actionListener="#{bRFileController.saveFileDB}" />
</h:form>
...
</h:panelGrid>
</rich:panel>
---------------------------------------------------------------------------
BRFileController.java(){
private byte[] upLoadFile;
private String upLoadFileName;
private String fileContentType;
public void setUpLoadFile(byte[] upLoadFile) {
this.upLoadFile = upLoadFile;
}