title: Removing dynamically added row from table having struts2
body: <p>i am quite new at this and i what to know  how can i get a index row from a dynamical table created with struts2. Here is what i have tried so far:</p>
  
  <p><strong>test file</strong></p>
  
  <pre><code>&lt;table class="table table-bordered table-striped table-condensed table-hover"
          id="exp"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th class="center"&gt;&lt;/th&gt;
              &lt;th&gt;Name&lt;/th&gt;
          &lt;/tr&gt;           
      &lt;/thead&gt;
  
      &lt;tbody&gt;
          &lt;s:if test="listanume.size&gt;0"&gt;
              &lt;s:iterator value="listanume" status="statusVar"&gt;
                  &lt;tr&gt;
                      &lt;td class="center"&gt;
                              &lt;button class="btn" onclick="javascript:setval(0)"&gt;
                                  delete
                              &lt;/button&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;s:property value="nume"/&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/s:iterator&gt;
          &lt;/s:if&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;h4&gt;Numarul randului este: &lt;s:property value="mysample"/&gt; &lt;/h4&gt;
  
      &lt;script&gt;
          var mysample= '';
          function= setval(varval){
              mysample=varval;
              alert(mysample);
          }
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>pop java</strong></p>
  
  <pre><code>public class Pop {
  private int nrrow;
   private List&lt;UserModel&gt; listanume = new ArrayList&lt;UserModel&gt;();
  
   UserModel user = new UserModel(),
          user1 = new UserModel(),
          user2 = new UserModel();
  
   private String[] sample;
  
   {
       sample = new String[]{"list1", "list2", "list3"};
   }
  
  
   public String execute() {
  
      user.setEmail("eret@esre");
      user.setPass1("1234");
      user.setNume("gigel");
  
      user1.setEmail("yuii@ihj");
      user1.setPass1("6789");
      user1.setNume("marius");
  
      user2.setEmail("nmnn@cvx");
      user2.setPass1("7676");
      user2.setNume("sorin");
  
      sample1.add(user);
      sample1.add(user1);
      sample1.add(user2);
  
      return "succes";
   }
  
   public String afisnrow(){
  
      execute();
      listanume=sample1;
  
      return "succes";
   }
  
   public String[] getSample() {
      return sample;
   }
  
   public void setSample(String[] sample) {
      this.sample = sample;
   }
  
   public List&lt;UserModel&gt; getSample1() {
      return sample1;
   }
  
   public void setSample1(List&lt;UserModel&gt; sample1) {
      this.sample1 = sample1;
   }
  
   public void setNrrow(int nrrow){
      this.nrrow=nrrow;
   }
  
   public int getNrrow(){
      return nrrow;
   }
  
   public List&lt;UserModel&gt; getListanume(){
      return listanume;
   }
  
   public void setListanume(List&lt;UserModel&gt; listanume){
      this.listanume=listanume;
   }
  }
  </code></pre>
  
  <p>every row has a button on it and when i  click that button i need to get the row index, i kind of stuck and run out of ideas, any suggestions?</p>