title: How can I remove or clear list in command object in JSP in SPRING MVC ,
body: <p>I am working with Spring MVC. My command object contains a collection object, it looks like as follows:</p>
  
  <pre><code>public class DimensionStoneBean {
  
      int stoneNo;
      float length;
      float breadth;
      float height;
      float dimension;
      String isIssued;
  
      public int getStoneNo() {
          return stoneNo;
      }
      public void setStoneNo(int stoneNo) {
          this.stoneNo = stoneNo;
      }
      public float getLength() {
          return length;
      }
      public void setLength(float length) {
          this.length = length;
      }
      public float getBreadth() {
          return breadth;
      }
      public void setBreadth(float breadth) {
          this.breadth = breadth;
      }
      public float getHeight() {
          return height;
      }
      public void setHeight(float height) {
          this.height = height;
      }
      public float getDimension() {
          return dimension;
      }
      public void setDimension(float dimension) {
          this.dimension = dimension;
      }
      public String getIsIssued() {
          return isIssued;
      }
      public void setIsIssued(String isIssued) {
          this.isIssued = isIssued;
      }
  
  }
  
  
  public class UpdateStockBean {
  
      @SuppressWarnings("rawtypes")
      private List dimensionStones =
          LazyList.decorate(new LinkedList(),FactoryUtils.instantiateFactory(DimensionStoneBean.class));
      long openbalance;
  
      public UpdateStockBean() {
          super();
      }
  
      @SuppressWarnings("rawtypes")
      public List getDimensionStones() {
          return dimensionStones;
      }
      public void setDimensionStones(@SuppressWarnings("rawtypes") List dimensionStones) {
          this.dimensionStones = dimensionStones;
      }
      public long getOpenbalance() {
          return openbalance;
      }
      public void setOpenbalance(long openbalance) {
          this.openbalance = openbalance;
      }
  
  }
  </code></pre>
  
  <p>The controller class for this, extends <code>AbstractWizardFormController</code>.</p>
  
  <p>I have used <code>formBackingObject()</code> to populate the command object return it to form.</p>
  
  <p>The form looks like as follows:</p>
  
  <pre><code>&lt;form:form commandName="updateStock" method="post" name="stockEntry" action="updateStock.nic" id="updateStock"&gt;
      &lt;br&gt;&lt;br&gt;&lt;br&gt;
  
      &lt;table border="1" width="700"&gt;
          &lt;tr&gt;     
              &lt;td class="textClr1" align="left" width="50"&gt;&lt;nobr&gt;Total No Of Stones&lt;/nobr&gt;&lt;/td&gt;
              &lt;td colspan="6"&gt;&lt;form:input tabindex="1" path="openbalance" id="openbalance" cssClass="controlStock"/&gt;&lt;/td&gt;
          &lt;/tr&gt;    
  
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td colspan="6"&gt;&lt;form:errors cssClass="error" path="openbalance"/&gt;&lt;/td&gt;
          &lt;/tr&gt; 
      &lt;/table&gt;
  
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td colspan="3"&gt;
  
              &lt;table  border="1" width="400"&gt;
                  &lt;tbody id="dimensionList"&gt;                           
                      &lt;c:forEach  var="DimensionStones" items="${updateStock.dimensionStones}" varStatus="i" begin="0"&gt;
  
                      &lt;tr class="dimensionStone"&gt;    
                          &lt;td&gt;&lt;form:input path="dimensionStones[${i.index}].stoneNo" id="stoneNo${i.index}" cssClass="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;form:input path="dimensionStones[${i.index}].length" id="length${i.index}" onchange="findDimension(this.id)" cssClass="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;form:input path="dimensionStones[${i.index}].breadth" id="breadth${i.index}" onchange="findDimension(this.id)" cssClass="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;form:input path="dimensionStones[${i.index}].height" id="height${i.index}" onchange="findDimension(this.id)" cssClass="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;form:input path="dimensionStones[${i.index}].dimension" id="dimension${i.index}" cssClass="controlStock"/&gt;&lt;/td&gt;                 
                          &lt;td&gt;&lt;form:checkbox path="dimensionStones[${i.index}].isIssued" id="isIssued${i.index}" value="" cssClass="check"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;a href="#" class="removeDimensionStone"&gt;&lt;img src="images/cross1.jpg" width="20" height="20" title="Remove Dimension Stone"/&gt;&lt;/a&gt;&lt;/td&gt;
                      &lt;/tr&gt;
  
                      &lt;/c:forEach&gt;   
  
                  &lt;tr&gt;&lt;/tr&gt;             
  
                  &lt;c:if test="${empty updateStock.dimensionStones}"&gt;
  
                      &lt;tr class="dimensionStone defaultRow"&gt;    
                          &lt;td&gt;&lt;input type="text" name="dimensionStones[].stoneNo" value="" id="stoneNo" Class="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="dimensionStones[].length" value="" id="length" onchange="findDimension(this.id)" Class="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="dimensionStones[].breadth" value="" id="breadth" onchange="findDimension(this.id)" Class="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="dimensionStones[].height" value="" id="height" onchange="findDimension(this.id)" Class="controlStock"/&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="dimensionStones[].dimension" value="" id="dimension" disabled="disabled" Class="controlStock"/&gt;&lt;/td&gt;                            
                          &lt;td&gt;&lt;input type="checkbox" name="dimensionStones[].isIssued" value="Yes" id="isIssued" Class="controlStock"/&gt;&lt;/td&gt; 
                          &lt;td&gt;&lt;a href="#" class="removeDimensionStone"&gt;&lt;img src="images/cross1.jpg" width="20" height="20" title="Remove Dimension Stone"/&gt;&lt;/a&gt;&lt;/td&gt;
                      &lt;/tr&gt;
  
                  &lt;/c:if&gt;   
  
                  &lt;/tbody&gt;  
              &lt;/table&gt;           
  
              &lt;/td&gt;    
          &lt;/tr&gt;    
      &lt;/table&gt;
  
      &lt;table  border="1" width="600"&gt; 
          &lt;tr&gt;
              &lt;td colspan="3" align="left"&gt;&lt;a href="#" id="addDimensionStone"&gt;&lt;img src="images/plus3.png" width="20" height="20" title="Add Dimension Stone"/&gt;&lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt; 
          &lt;tr&gt;&lt;/tr&gt; 
          &lt;tr&gt;&lt;/tr&gt; 
          &lt;tr&gt;
              &lt;td colspan="3" align="center" width="200" height="180"&gt;
                  &lt;input type="submit" name="_target0" value="Submit" class="butn" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;  
      &lt;/table&gt;  
  &lt;/form:form&gt;
  </code></pre>
  
  <p>In the above form can I remove or clear items in the list <code>updateStock.dimensionStones</code>? If it is possible in <code>JSTL</code>, <code>EL</code> or in <code>scriptlet</code> please give me the answer as soon as possible.</p>