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:
<form method="GET" action="reporting.action" >
<s:hidden name="roomsReport" value="%{allRooms}"/>
<s:textfield name="roomsR" value="%{allRooms}"/>
<s:submit name="action" style="width:220px;" value="Generate Report for Rooms" />
</form>
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:
System.out.println("xxx"+this.roomsReport.size());
System.out.println(this.roomsReport);
Both above print statements give 0 and [] respectively. I have the getters and setters for roomsReport as follows:
private List<Room> roomsReport;
public List<Room> getRoomsReport() {
return roomsReport;
}
public void setRoomsReport(List<Room> roomsReport) {
this.roomsReport = roomsReport;
}
Can anyone help ?