Announcement Announcement Module
No announcement yet.
list size for checkboxes in table? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • list size for checkboxes in table?

    I have a form with rows of data in a table, from a database. The user can delete some rows; they have a checkbox in the last column. The ones that can't be deleted don't have a checkbox. So not all rows have checkboxes.

    The form object has a List of String where it stores the deletes. My question is, how big do I make that list? I'm guessing that I should create the form object in the formBackingObject() method and have the object's constructor take an argument for the list size. Does that make sense?

    I'm asking because the Spring MVC and SWF book says that you need to preallocate the things that are collections.

    Hmm, I just tested it by not specifying an initial size of the ArrayList and it worked. Lost in the shadows again.
    <c:if test="${!empty ch.deleteId}">
      <spring:bind path="deleteForm">
        <input type="checkbox" name="deletes[${ch_rowNum}]"
            id="deletes[${ch_rowNum}]" value="${ch.deleteId}" />
      <c:set var="canDelete" value="true" />