title: jquery or jquery mobile are messing Struts2 file upload
body: <p>Note: this question has been edited now that I have narrowed down the root of the problem.</p>
  
  <p>New information: I found out that either jquery or more specifically jquery mobile are causing the problem. Somehow my submit form is being messed with so the file is not being sent.</p>
  
  <p>By using Firebug I saw some jquery mobile warnings related to the form and realized that that could be the problem. The thing is that the simple upload page I made for testing (the one shown in the old question below) has no jquery mobile references, but for some reason some styles get passed from the page I use to access that test page. Once I access the page directly without going through a jquerymobile page, and I see no styles are being applied, the test app works fine.</p>
  
  <p>I am really new to this so I don't really know how to check if the file was sent at all, which I think is the problem. I have been messing with Firebug and when looking at the XHR data I see all form text fields are being sent but I see no reference to the file parameter (but maybe that is sent separately due to the size, I cannot tell because I don't really know the inner workings of XHR).</p>
  
  <p>I have tried disabling html data validation adding novalidate to the form element. Also I tried setting data-enhance="false" and data-ajax="false" to a div wrapping the form element (I didn't forget to add this code:</p>
  
  <pre><code>&lt;script&gt;
  $(document).on('mobileinit', function () {
  $.mobile.ignoreContentEnabled = true;
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>so those settings would work). I'm still out of ideas. Any help would be really appreciated.</p>
  
  <p>Old question (might be useful to understand the whole issue):</p>
  
  <p>I've been investigating this issue all day and I've run out of ideas.
  I've made a somewhat complicated action to handle a form and everything works fine except the file that should be uploaded with the rest of the form data. 
  file, fileContentType and fileFileName dont get populated, they are null when trying to access them inside the action.</p>
  
  <p>In an attempt to narrow the problem I made a very simple file upload action but it still fails in the same way. Here is my code:</p>
  
  <p>Action:</p>
  
  <pre><code>import java.io.File;
  import com.opensymphony.xwork2.ActionSupport;
  
  
  public class Prueba extends ActionSupport  {
  
  
  
      private File file;
      private String fileContentType;
  private String fileFileName;
  
  public String execute(){
  
      String r = "failure";
      if (this.file != null){
          r = "success";
          System.out.println("file was uploaded!");
      }
      else {
          System.out.println("file is null :(");
      }
      return r;
  }
  
  
  public void setFile(File file) {
      this.file = file;
  }
  
  
  
  public void setFileContentType(String fileContentType) {
      this.fileContentType = fileContentType;
  }
  
  
  public void setFileFileName(String fileFileName) {
      this.fileFileName = fileFileName;
  }   
  }
  </code></pre>
  
  <p>jsp:</p>
  
  <pre><code>&lt;%@ page language="java" pageEncoding="UTF-8"%&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags" %&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;título&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;s:form action="Prueba" method="post" enctype="multipart/form-data"&gt;
          &lt;s:file name="file" label="File"/&gt;
          &lt;s:submit/&gt;
      &lt;/s:form&gt;   
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>struts.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
  
  &lt;struts&gt;
  
  &lt;constant name="struts.devMode" value="true"/&gt; 
  &lt;constant name="struts.multipart.maxSize" value="3145728" /&gt;
  &lt;constant name="struts.custom.i18n.resources" value="global" /&gt;
  
  &lt;package name="default" namespace="/" extends="struts-default"&gt;
  
      &lt;global-results&gt;
          &lt;result name="error"&gt;pages/error.jsp&lt;/result&gt;
          &lt;result name="failure"&gt;pages/info.jsp&lt;/result&gt;
          &lt;result name="login"&gt;pages/login.jsp&lt;/result&gt;
      &lt;/global-results&gt;
  
      &lt;!-- In the original file there are several actions defined here that I will omit for readability --&gt;
  
      &lt;action name="Prueba" class="edu.uoc.recetario.struts2.Prueba"&gt;
          &lt;interceptor-ref name="defaultStack"&gt;
                     &lt;param name="fileUpload.allowedTypes"&gt;text/plain&lt;/param&gt;
                     &lt;param name="fileUpload.maximumSize"&gt;10240&lt;/param&gt;
                  &lt;/interceptor-ref&gt; 
          &lt;result name="success"&gt;pages/fileisnotnull.jsp&lt;/result&gt;
          &lt;result name="failure"&gt;pages/fileisnull.jsp&lt;/result&gt;
      &lt;/action&gt;
      &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>As far as I can tell I've followed the naming conventions for fileUploadInterceptor, which was the most common problem in other stackoverflow similar issues. Also I've got the commons-fileupload-1.3.jar and commons-io-2.0.1.jar libraries (and I suspect that those libraries missing would throw some exceptions, but I get no errors when uploading, it's just that the attributes in the action don't get populated).</p>
  
  <p>The other useful information I can think of is that I deploy in Apache Tomcat 7.0 inside Eclipse, and that I'm using the latest version of Struts2 (2.3.15.3). I have heard that odd versions are unstable, but this is the one the official struts2 site is offering so I would think that is not the problem.</p>
  
  <p>I've also tried to set struts.multipart.saveDir=/tmp in the struts.properties file, to no avail.</p>
  
  <p>And I've tried the Struts2Example-1.0.0 app deploying it just like I've deployed my own app and that one works. So that leads me to think it's not an Eclipse/Tomcat configuration issue.</p>
  
  <p>I'm absolutely clueless at this point. Please help.
  Thx</p>