title: How to send a list of object from jsp to struts2 action class?
body: <p>I am new to Struts2. I have a JSP page which shows a list of Rooms (where Room is a user-defined class). I need to send this entire list to the action class as a hidden field. The JSP code is as follows:</p>
  
  <pre><code>&lt;form method="GET" action="reporting.action" &gt;  
    &lt;s:hidden name="roomsReport" value="%{allRooms}"/&gt;
    &lt;s:textfield name="roomsR" value="%{allRooms}"/&gt;                       
    &lt;s:submit name="action" style="width:220px;" value="Generate Report for Rooms" /&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>The textfield (used for testing) shows the address for the list (implying that its not null in the jsp page)
  I am still unable to access it in my ReportingAction class using the following code:</p>
  
  <pre><code>System.out.println("xxx"+this.roomsReport.size());
  System.out.println(this.roomsReport);
  </code></pre>
  
  <p>Both above print statements give 0 and [] respectively. I have the getters and setters for roomsReport as follows:</p>
  
  <pre><code>private List&lt;Room&gt; roomsReport;
  public List&lt;Room&gt; getRoomsReport() {
    return roomsReport;
  }
  
  public void setRoomsReport(List&lt;Room&gt; roomsReport) {
    this.roomsReport = roomsReport;
  }
  </code></pre>
  
  <p>Can anyone help ?</p>