title: ArrayIndexOutOfBoundsException when use getParameterValues in Servlet
body: <p>Here is is my HTML ..... </p>
  
  <p>I take one input for count how many input .. and then highest four entry can be given.... </p>
  
  <pre><code> No Of Members: &lt;select name="member" class="form-control"&gt;
            &lt;option value="0"&gt;Select&lt;/option&gt;
           &lt;option value="1"&gt;1&lt;/option&gt;
           &lt;option value="2"&gt;2&lt;/option&gt;
           &lt;option value="3"&gt;3&lt;/option&gt;
            &lt;option value="4"&gt;4&lt;/option&gt;
  
  
         &lt;/select&gt;
  
   &lt;table class="table table-bordered"&gt;
  
                  &lt;tbody&gt;
                        &lt;tr&gt;
                          &lt;td&gt;&lt;input type="text" name="studentid" class="form-control" id="" placeholder="Enter Student ID"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="name" class="form-control" id="" placeholder="Enter Name"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="email" class="form-control" id="" placeholder="Enter Email"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="cgpa" class="form-control" id="" placeholder="Enter CGPA"&gt;&lt;/td&gt;
                      &lt;tr/&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;input type="text" name="studentid" class="form-control" id="" placeholder="Enter Student ID"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="name" class="form-control" id="" placeholder="Enter Name"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="email" class="form-control" id="" placeholder="Enter Email"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="cgpa" class="form-control" id="" placeholder="Enter CGPA"&gt;&lt;/td&gt;
                      &lt;tr/&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;input type="text" name="studentid" class="form-control" id="" placeholder="Enter Student ID"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="name" class="form-control" id="" placeholder="Enter Name"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="email3" class="form-control" id="" placeholder="Enter Email"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="cgpa" class="form-control" id="" placeholder="Enter CGPA"&gt;&lt;/td&gt;
                      &lt;tr/&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;input type="text" name="studentid" class="form-control" id="" placeholder="Enter Student ID"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="name" class="form-control" id="" placeholder="Enter Name"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="email" class="form-control" id="" placeholder="Enter Email"&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="cgpa" class="form-control" id="" placeholder="Enter CGPA"&gt;&lt;/td&gt;
                      &lt;tr/&gt;
  
  
                  &lt;/tbody&gt;
              &lt;/table&gt;
  </code></pre>
  
  <p>My Servlet </p>
  
  <p>At first i take member no at a int type variable.. and then all the four field in four different array by getParameterValues. </p>
  
  <pre><code>  try{
              int member=Integer.parseInt(request.getParameter("member"));
              String stdID[]=request.getParameterValues("studentid");
              String name[]=request.getParameterValues("name");
              String email[]=request.getParameterValues("email");
              String cgpa[]=request.getParameterValues("cgpa");
  
              for(int i=0;i&lt;=member;i++){
  
                  System.out.println(stdID[i]+name[i]+email[i]+cgpa[i]);
              }
  
  
          }catch(Exception e){
              System.out.println(e);
              e.printStackTrace();
  
          }
  </code></pre>
  
  <p>When  i run this code and select No member (4) and fill all the field and then press submit.... </p>
  
  <p>In my console below errors show</p>
  
  <p><img src="https://i.stack.imgur.com/WPGiB.png" alt="enter image description here"></p>
  
  <p>How can i solve this ? any idea ?</p>