title: sending excel file to spring MVC
body: <p>I try to sending excel sheet to spring mvc controller, from where i am fetching  excel sheet data and try to insert these data in some tables.</p>
  
  <p>Here is my mvc controller:</p>
  
  <pre><code>@RequestMapping(value="/uploadorder", method =RequestMethod.POST , headers="Content-Type=multipart/form-data")
  public @ResponseBody String uploadFile(UploadForm uploadItem, BindingResult result) throws IOException
  {
  
  
  
      System.out.println("checking for upload item" );
      if(uploadItem == null) {
          System.out.println("file is null");
      } else {
          System.out.println("file is not null");
      }
  
      System.out.println("Inside Consignment controller");
  
  
  System.out.println( "jdfasdjfas;dfja"+uploadItem.getFile());
      InputStream is = uploadItem.getFile().getInputStream();
  
      }
  </code></pre>
  
  <p><code>uploadItem</code> contains some data,But when i am trying to fethc it , i am getting 
  NullPointerException.</p>
  
  <p><strong>UploadForm code</strong>:</p>
  
  <pre><code>import org.springframework.web.multipart.commons.CommonsMultipartFile;
  
  public class UploadForm {
  
  private CommonsMultipartFile file;
  
  public CommonsMultipartFile getFile() {
  return file;
  }
  
  public void setFile(CommonsMultipartFile file) {
  this.file = file;
  }
  
  }
  </code></pre>
  
  <p>How can I fetch data from <code>uploadItem</code>?</p>