title: <c:foreach jsp iterate over list
body: <p>I have searched several examples, still have not get. I am passing an List of GOOD object from controller into jsp pages. trying to loop over the list object, but its showing only one element repeatedly. should I use beans? If yes, could you provide more specific example for my case.</p>
  
  <pre><code> &lt;c:if test="${not empty listGood}"&gt;
       &lt;c:forEach var="ob" varStatus="status" items="${listGood}"&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;c:out value="${ob.name}"/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;c:out value="${ob.measure}"/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;c:out value="${ob.quantity}"/&gt;&lt;/td&gt;
          &lt;td&gt;&lt;c:out value="${ob.price}"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
               &lt;/c:forEach&gt;
              &lt;/c:if&gt;
  </code></pre>
  
  <p><strong>Update</strong>
  Here is the controller:</p>
  
  <pre><code>@RequestMapping(value={"/supply"}, method=RequestMethod.POST)
  public String consumptFormulate(Locale locale, Model model, @ModelAttribute ConsumptionForm cmd, HttpServletRequest request){
    String[] s_str =cmd.getFromDate().split("/");
    String normal_s  = s_str[2]+"-"+s_str[0]+"-"+s_str[1];
    String[] f_str = cmd.getToDate().split("/");
     String normal_f  = f_str[2]+"-"+f_str[0]+"-"+f_str[1];
       List&lt;Good&gt; list = service.getGoods(normal_s,normal_f,cmd.getSocGoods(),cmd.getTradeObj());
       List&lt;ListGoodsForm&gt; listg = new ArrayList&lt;ListGoodsForm&gt;();
       org.jfree.data.xy.XYSeries series = new org.jfree.data.xy.XYSeries("За месяц:");
       if(!list.isEmpty()){
           lg=list;
           ListGoodsForm listo = new ListGoodsForm();
           java.util.Calendar ca = java.util.Calendar.getInstance();
  
           for(Good g: list){
               listo.setName(g.getName());
               listo.setMeasure(g.getMeasure());
               listo.setPrice(g.getPrice());
               listo.setQuantity(g.getQuantity());
               listg.add(listo);
               java.util.Date date = g.getDates();
               java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("MMMM");
                ca.setTime(date);
               int in = ca.get(java.util.Calendar.MONTH);
                   String month = format.format(date);
          }
              }
         request.setAttribute("listGood",listg);
       //model.addAttribute("listGood", listg);
       model.addAttribute("GOODS", prepareDataList());
      // model.add
       model.addAttribute("COMPANY",sservice.getSupplierName());
       model.addAttribute("consumptionForm", cmd);
  
     return "supply";  
  }
  </code></pre>