Hi,

I'm trying to use the file upload features from struts. I know that this is
suppose to be easy to use. But I keep receiving a null form in my perform
method and I can't figure out the problem.

JSP code:
---------
<form:form action="upload.do" name="uploadForm" method="POST"
enctype="multipart/form-data" type="UploadForm">
<form:file property="file" />
<form:submit property="submit" value="Submit"/>
</form:form>

UploadForm code:
---------------
public final class UploadForm extends ActionForm
{
private FormFile file;
public FormFile getFile() { return file;}
public void setFile(FormFile file) {this.file = file;}
}

UploadAction:perform() code:
----------------------------
public
ActionForward perform(ActionMapping mapping,
     ActionForm form, HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException
{
    UploadForm fileForm = (UploadForm) form;    <== form is coming null
    FormFile file = fileForm.getFile();
        .........
}


Any help will be appreciated.

juan

Reply via email to