title: Error occured when trying to upload file using html:file in Struts
body: <p>I came across a problem that when I try to upload a file in Struts using <code>&lt;html:file/&gt;</code></p>
  
  <p>this is part of my jsp</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td width="18%" bgcolor="#DEE3E7" align="center"&gt;
          &lt;bean:write name="replaceAttachmentsForm" property="destId"/&gt;
      &lt;/td&gt;
      &lt;td&gt;
          Subject
      &lt;/td&gt;
      &lt;td width="18%" bgcolor="#DEE3E7" align="center"&gt;
           &lt;bean:write name="replaceAttachmentsForm" property="concernedDept"/&gt;
      &lt;/td&gt;
      &lt;td width="18%" bgcolor="#DEE3E7" align="center"&gt;
            &lt;bean:write name="replaceAttachmentsForm" property="letterSubject"/&gt;
      &lt;/td&gt;
      &lt;td width="18%" bgcolor="#DEE3E7" align="center"&gt;
         &lt;html:file property="formFileLetter" name="replaceAttachmentsForm"  &gt;&lt;/html:file&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  </code></pre>
  
  <p>And this is the registered bean</p>
  
  <pre><code>public class ReplaceAttachmentsForm extends WebActionForm{
  private FormFile formFileLetter;
  private FormFile formFileAttachment;
  
  public void setFormFileLetter(FormFile formFileLetter) {
      this.formFileLetter = formFileLetter;
  }
  
  public FormFile getFormFileLetter() {
      return formFileLetter;
  }
  
  public void setFormFileAttachment(FormFile formFileAttachment) {
      this.formFileAttachment = formFileAttachment;
  }
  
  public FormFile getFormFileAttachment() {
      return formFileAttachment;
  }}
  </code></pre>
  
  <p>The problem here is that whenever I try to upload a file an exception </p>
  
  <p>"Cannot invoke ae.ems.let.web.ReplaceAttachmentsForm.setFormFileLetter on bean class 'class ae.ems.let.web.ReplaceAttachmentsForm' - type mismatch - had objects of type "java.lang.String" but expected signature "org.apache.struts.upload.FormFile"</p>
  
  <p>Can anyone suggest Why am I not able to upload a file using Struts tags? Any help in this regard is highly appreciated.</p>