Hi all, I am trying to incorporate struts file upload in web flow. I'm running into a problem that struts FormFile is always null. However, my FlowAction extension class is able to access the FormFile.
Here is my setup
public class HtmlForm extends ActionForm {
private FormFile uploadFile;
public FormFile getUploadFile() {
return uploadFile;
}
public void setUploadFile(FormFile uploadFile) {
this.uploadFile = uploadFile;
}
}
public class HtmlAction extends FormAction{
public HtmlAction() { ...}
public Event process () {
HtmlForm form = (HtmlForm)context.getFlowScope().get("htmlForm");
// FormFile is always null
FormFile ff = form.getUploadFile();
}
public class CustomStrutsAction extends FlowAction {
protected ActionForward doExecuteAction(org.apache.struts.action.ActionMap ping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception {
HtmlForm htform = (HtmlForm)form;
// FormFile is not null
FormFile ff = htform.getUploadFile();
}
struts-config.xml
<action-mappings>
<action path="/home" forward="/WEB-INF/index.jsp"/>
<action path="/wiz"
type="CustomStrutsAction"
name="htmlForm" scope="request"
className="org.springframework.web.flow.struts.Flo wActionMapping">
<set-property property="flowId" value="htmlWiz" />
</action>
</action-mappings>
jsp..
<html:form action="wiz.do?_flowId=htmlWiz" method="post" enctype="multipart/form-data">
<INPUT type="hidden" name="_flowExecutionId" value="<c:out value="${flowExecutionId}"/>">
<INPUT type="hidden" name="_eventId" value="submit">
<INPUT type="file" name="uploadFile">
<INPUT type="submit" value="Next">
</html:form>
I am really stuck here.. Hope someone can point me to the right direction..


Reply With Quote