struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Gargiulo" <>
Subject file upload
Date Sat, 16 Dec 2000 01:58:15 GMT

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="" name="uploadForm" method="POST"
enctype="multipart/form-data" type="UploadForm">
<form:file property="file" />
<form:submit property="submit" value="Submit"/>

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:
ActionForward perform(ActionMapping mapping,
     ActionForm form, HttpServletRequest request, HttpServletResponse
throws IOException, ServletException
    UploadForm fileForm = (UploadForm) form;	<== form is coming null
    FormFile file = fileForm.getFile();

Any help will be appreciated.


View raw message