title: Getting arraylist from jsp page's hidden field to action class using struts2
body: <p>I have an arraylist which i have set into jsp's hiddenField.Now I have to access this list in my action class. Below,code snippets are as follows</p>
  
  <p>My action Class</p>
  
  <pre><code>private ArrayList&lt;TXT_File_Action&gt; statusResult_list=new ArrayList&lt;TXT_File_Action&gt;();
      private ArrayList&lt;TXT_Beans&gt; regenerateTXTList=new ArrayList&lt;TXT_Beans&gt;();
      private ArrayList&lt;TXT_Beans&gt; pagingList=new ArrayList&lt;TXT_Beans&gt;();
      private ArrayList&lt;TXT_Beans&gt; serverList=new ArrayList&lt;TXT_Beans&gt;();
  
  
  
  public String getGenerateList()
      {
  
            for(int j=0;j&lt;customers_accountList.size();j++)
                 {
  
                 dataList=txt_managerInstance.regenerateListData(id_no);  
                 regenerateTXTList.add(dataList.get(0));
             }
  
                 pagingList=getRegenerateTXTList();
                 setRegenerateTXTList(getRegenerateTXTList());
                 setPagingList(getPagingList());
  
          return SUCCESS;
        }
  
    getters..n setters
  </code></pre>
  
  <p>My JSP code is</p>
  
  <pre><code> &lt;s:iterator value="pagingList"&gt;
  &lt;tr&gt;
       &lt;td align="center"&gt;&lt;s:property value="customerId" /&gt;&lt;/td&gt;  
       &lt;td align="center"&gt;&lt;s:property value="cspId" /&gt;&lt;/td&gt;    
       &lt;td align="center"&gt;&lt;s:property value="branchCode" /&gt;&lt;/td&gt;
       &lt;td align="center" id="bcID"&gt;&lt;s:property value="bcCode"/&gt;&lt;/td&gt;
   &lt;/tr&gt;
  
  &lt;/s:iterator&gt;
  </code></pre>
  
  <p>and below I set the list in jsp hidden field like this :</p>
  
  <pre><code>   &lt;input type="hidden" name="serverList" id="serverList"  value="&lt;s:property value="pagingList"/&gt;"/&gt;
  </code></pre>
  
  <p>Now I want this list in my action class when I click to an event.
  Whenever I tried to print the size of this list <strong>serverList</strong> in my action I got following error: </p>
  
  <pre><code>java.lang.ArrayIndexOutOfBoundsException: -1
      java.util.ArrayList.get(Unknown Source)
      com.alw.action.TXT_File_Action.setPaginationList(TXT_File_Action.java:424)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
          .
          .
          .
  </code></pre>
  
  <p>But I sure i get all Arrayllist data in this hidden field because I have checked this on my page</p>
  
  <pre><code>**&lt;input type="hidden" name="serverList" id="serverList"  value="&lt;s:property value="pagingList"/&gt;"/&gt;**
  </code></pre>
  
  <p>what is going wrong with this, How to get this list in my action class.
  any help would be very helpfull.</p>