struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Gargiulo" <j...@mindstech.com>
Subject file upload
Date Sat, 16 Dec 2000 01:58:15 GMT
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


Mime
View raw message