title: How to get objects from an ArrayList inside a session using Spring?
body: <p>Using Spring I'm trying to obtain and print the attributes from the object "Auto". Under my controller I'm requested the data from a form... I create a new object "Auto" using that data.. then I add that created object into an ArrayList and finally pass the ArrayList to a session. However, when I try to obtain and print the data from the ArrayList I get nothing, a blank page.</p>
  
  <p>Auto.class code:</p>
  
  <pre><code>package beans;
  
  
  public class Auto {
  
  
  private String codigo;
  private String marca;
  private String modelo;
  
  public Auto() {
  }
  
  
  public Auto(String codigo, String marca, String modelo) {
      this.codigo = codigo;
      this.marca = marca;
      this.modelo = modelo;
  }
  
  public String getCodigo() {
      return codigo;
  }
  
  public void setCodigo(String codigo) {
      this.codigo = codigo;
  }
  
  public String getMarca() {
      return marca;
  }
  
  public void setMarca(String marca) {
      this.marca = marca;
  }
  
  public String getModelo() {
      return modelo;
  }
  
  public void setModelo(String modelo) {
      this.modelo = modelo;
  }
  
  @Override
  public String toString() { 
  return "codigo: '" + this.codigo + "', marca: '" + this.marca + "', modelo: '" + this.modelo + "'";
  }
  
  
  }
  </code></pre>
  
  <p>This is my controller code:</p>
  
  <pre><code>@Controller
  
  public class procesarController {
  
  
  @RequestMapping(value = "/procesar.htm" , method = RequestMethod.POST)
  public String addAuto(@RequestParam("codigo") String codigo,
         @RequestParam("marca") String marca,
         @RequestParam("modelo") String modelo,
         Model m,HttpSession s) 
  {
    Auto a = new Auto(codigo,marca,modelo);
    ArrayList&lt;Auto&gt; autos = new ArrayList();
    autos.add(a);
    //m.addAttribute(autos);
    s.setAttribute("vehiculo", autos);     
  
  
    return "otro";
  }
  
  
  }
  </code></pre>
  
  <p>Here my jsp "otro" where I'm trying to print the ArrayList:</p>
  
  <pre><code>&lt;h1&gt;pagina de resultado&lt;/h1&gt;
  
  
      &lt;table border="1"&gt;
  
          &lt;c:forEach var="a" items="${sessionScope.vehiculo}" &gt;
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td&gt;Codigo&lt;/td&gt;
                  &lt;td&gt;Marca&lt;/td&gt;
                  &lt;td&gt;Modelo&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;${a.codigo}&lt;/td&gt;
                  &lt;td&gt;${a.marca}&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
          &lt;/c:forEach&gt;
      &lt;/table&gt;
  </code></pre>