To use file upload, you need to specify the method and encoding for the
form, like this:

  <html:form action="/upload" method="post" enctype="multipart/form-data">
    ...
  </html:form>

--
Martin Cooper


----- Original Message -----
From: "Barłomiej Pawłowski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 01, 2001 7:24 AM
Subject: problem with FormFile


> Hi,
> I have created file upload.jsp:
> <%@ page contentType="text/html; charset=ISO-8859-2" %>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
> <html:html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2">
>
> <META NAME="Author" CONTENT="Bartlomiej Pawlowski">
> <title>upload</title>
> </head>
> <body>
>   <html:form action="/upload" >
>    File <html:file property="file" maxlength="30" styleClass="form2"/>
>    <html:submit>Upload</html:submit>
>   </html:form>
> </body>
> </html:html>
> and ActionForm bean:
> public class UploadForm extends ActionForm {
>
>     private FormFile file;
>     public UploadForm() {
>     }
>
>     public void setFile(FormFile file) {
>         this.file = file;
>     }
>     public FormFile getFile() {
>         return file;
>     }
> }
>
> when I submit this form I receive following exception:
>
> Internal Servlet Error:
>
> javax.servlet.ServletException: BeanUtils.populate
>  at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:486)
>  at
>
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19
10)
>
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521)
>
> Root cause:
> java.lang.IllegalArgumentException: argument type mismatch
>  at java.lang.reflect.Method.invoke(Native Method)
>  at
>
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:82
5)
>
>  at
>
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:75
6)
>
>  at
> org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782)
>
> What is wrong?
> Who can help me?
>
>


Reply via email to