I need to display several lists of choice to the user. These lists are variable in length depending on the user. I use an ActionForm which contain Lists. I populate these with objects that contain String and boolean properties (name of option and selected flag). I add this to the request scope under the mapping.getAttribute() key and everything is displayed fine in my JSP page. However when it comes time to submit the changes a new ActionForm is created with empty Lists and unsurprisingly I get the error message:
exception: javax.servlet.ServletException: BeanUtils.populate ... root cause: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 ... Here's a snippet from the JSP page to show how I'm displaying the information: ... <c:forEach varStatus="status" var="media" items="${emailalertForm.media}"> <tr> <td><fmt:message key="${media.mediaName}" /></td> <td><html:checkbox property="media[${status.index}].selected" /></td> </tr> </c:forEach> ... The question is how can I display lists of choices to the user and get the changes the user makes to the checkboxes back to my Action? I've read about nested beans but the only examples I found only had a single bean and not a collection. Is it possible or is there a better way to go about this? Thanks for any advice or pointers, Ed!