title: validating a form in jsp before submission
body: <p>I have a form in jsp, My input fields are also "required" but when I submit the form it does not block the submission if the required fields are empty. I don't understand it,please help thanks in advance.Here is my jsp form :</p>
  
  <pre><code> &lt;form id="addterminal" name="catForm" action="actions/Terminal.jsp" method="post" enctype="multipart/form-data"&gt;
        &lt;fieldset&gt;
          &lt;label&gt;Add Terminal&lt;/label&gt;
        &lt;%  String action = request.getParameter("action");
          if(action == null)
          {
  
          }
        else if(action.equals("add_success"))
          {
              %&gt;
              &lt;div class="alert success"&gt;Terminal added Successfully...&lt;/div&gt;
                &lt;%
          }
  
           else if(action.equals("add_failure"))
          {
              %&gt;
  
              &lt;div class="alert failure"&gt;Terminals not added,File Format is incorrect...&lt;/div&gt;
              &lt;%
          } 
          %&gt;
          &lt;section&gt;
            &lt;label for="input"&gt;Terminal ID&lt;/label&gt;
            &lt;div&gt;
              &lt;input type="text" id="input" name="tid" required&gt;
            &lt;/div&gt;
          &lt;/section&gt;
          &lt;section&gt;
            &lt;label for="input"&gt;Merchant Name&lt;/label&gt;
            &lt;div&gt;
              &lt;input type="text" id="input" name="merchName" required&gt;
            &lt;/div&gt;
          &lt;/section&gt;
  
          &lt;section&gt;
            &lt;label for="file_upload"&gt;Upload Bulk Terminals File&lt;br&gt;
              &lt;span&gt;Format of the File should be .csv&lt;/span&gt;&lt;/label&gt;
            &lt;div&gt;
              &lt;input type="file" id="file_upload" name="termbulkfile"&gt;
            &lt;/div&gt;
          &lt;/section&gt;
  
          &lt;section&gt;
            &lt;div&gt;
         &lt;!--      &lt;button onclick="javascript:document.catForm.reset()"&gt;Reset&lt;/button&gt;
         --&gt;       &lt;button onclick="javascript:document.catForm.submit()"&gt;Submit&lt;/button&gt;
  
              &lt;/div&gt;
          &lt;/section&gt;
        &lt;/fieldset&gt;
      &lt;/form&gt;
  </code></pre>