title: Trouble passing a List object as hidden variable from JSP to a servlet
body: <p>I am trying to  render a list of objects in my controller  which are passed from jsp as hidden varaiable.</p>
  
  <p>Here is my code</p>
  
  <p><strong>in my employeeResults.jsp</strong></p>
  
  <pre><code>&lt;c:forEach items="${list}" var="employee"  &gt;
  &lt;tr&gt;
  &lt;td&gt;${employee.empId}&lt;/td&gt;
  &lt;td&gt;${employee.empName}&lt;/td&gt;
  &lt;td&gt;${employee.empEmail}&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/c:forEach&gt; 
  &lt;form  method="POST"  action="downloadCSV.html" &gt;
  &lt;input type="hidden" id="empList" name="empList" value="${list}"/&gt;
  &lt;input type="submit" name="download" value="Download"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>In my Controller</strong></p>
  
  <p>// method call for employee search  </p>
  
  <pre><code>@RequestMapping(value = "/search", params = "search", method = RequestMethod.POST)
  public ModelAndView lookupEmployee(@ModelAttribute("command") Employee emp) {
  
  String lookupEmpId = null;
  if(emp.getEmpId()!= null)
  lookupEmpId = emp.getEmpId();
  String[] line = lookupEmpId.split("\n");
  List&lt;String&gt; eIds = new ArrayList&lt;String&gt;();
  
  for(String i: line){
  eIds.add(i);
  }
  
  List&lt;Employee&gt; listEmp = employeeDAO.searchRecords(eIds); 
  ModelAndView model = new ModelAndView("lookupResults");  
  model.addObject("list",listEmp);
      return model;
  
  }// addContact()
  
    @RequestMapping(value = "/downloadCSV", method = RequestMethod.POST)
      public void downloadCSV(HttpServletRequest request, HttpServletResponse response) throws       IOException {
  
      String empList = request.getParameter("empList");
      List&lt;String&gt; items = Arrays.asList(empList.split("\\s*,\\s*"));
      -----
      }
  </code></pre>
  
  <p>when I run  empList is returning a sting in array format , but I would like to do is to get the Employee object list  from jsp .</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Thanks in advance !</p>