title: How can i check jsp form request submit in same jsp page? (enctype="multipart/form-data")
body: <pre><code>&lt;%
  ..... code to check request is submitted or not ...
  %&gt;
  &lt;form method="post" action="" name="uploadform" enctype="multipart/form-data"&gt;
    &lt;table &gt;  
      &lt;tr&gt;    
        &lt;td&gt;Select up to 3 files to upload&lt;/td&gt;
      &lt;/tr&gt;    
      &lt;tr&gt;    
        &lt;td&gt;   
          &lt;input type="hidden" name="newFileName" value="newUploadedFileName1"&gt;
          &lt;input type="file" name="uploadfile" &gt;
          &lt;/td&gt;    
      &lt;/tr&gt;    
      &lt;tr&gt;    
       &lt;td align="center"&gt;   
        &lt;input type="submit" name="Submit" value="Upload"&gt;
        &lt;input type="reset" name="Reset" value="Cancel"&gt;
       &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The jsp post request code to upload files will be in same page above in &lt;% .. %> tag.</p>
  
  <p>How can i add a check with if statement to check whether the Submit button is clicked or not , in other words whether a post request is sent or not.</p>
  
  <p>I followed this , <a href="http://www.java2s.com/Code/Java/JSP/SubmittingCheckBoxes.htm" rel="nofollow">http://www.java2s.com/Code/Java/JSP/SubmittingCheckBoxes.htm</a>  but it did not help and that is to call a different jsp file ("formAction.jsp") not in same page .</p>
  
  <pre><code>if(request.getParameter("newFileName") != null) {
  </code></pre>
  
  <p>This statement always gives null value. I don't know why.</p>
  
  <p>Note: it's a form with this attribute => enctype="multipart/form-data"</p>
  
  <p>If i don't add any if statement then the files are uploaded for the first time , but next time if i click the reload button or refresh the page , the browser prompts me to resend the data or to reupload the previous files . I hope you have understood the problem. If there is any confusion to understand the problem please comment .</p>
  
  <p>Can anyone give some hint/solution ?</p>