title: How can I pass a complex object from controller to the view (jsp)
body: <p>I need to pass a complex object from Spring MVC controller to the view and be able to use all of it's properties. The object has the list of other class's objects in itself, and those have lists of other class's objects and so on. I'm trying to render multilevel unordered list out of it that will be used as treeView.</p>
  
  <p>Can I do this, and how?</p>
  
  <p>I've already tried passing it "regularly" btw, but I get </p>
  
  <pre><code>org.apache.jasper.el.JspPropertyNotFoundException: /WEB-INF/pages/index.jsp(29,8) '${rootAsObject.JWSs}' Property 'JWSs' not found on type com.model.Root
  </code></pre>
  
  <p>My controller...</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET)
  public String someFunction(ModelMap model,HttpServletRequest request) {
  
      model.addAttribute("rootAsAttribute", this.GenerateTreeView(appconfigProperties));
      model.addObject("rootAsObject", this.GenerateTreeView(appconfigProperties));
  
      return "index"; 
  }
  </code></pre>
  
  <p>My index.jsp</p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;link href="css/style.css" rel="stylesheet" type="text/css"/&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div style="float: left; width: 20%; height: 100%; overflow-x: scroll"&gt;
      &lt;ul&gt;
          &lt;c:forEach items="${rootAsObject.JWSs}" var="jws"&gt;
              &lt;li&gt;${jws.ActualFile.getName()}&lt;/li&gt;
          &lt;/c:forEach&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div style="float: left; width: 80%" id="thePage"&gt;
      &lt;iframe id="frame1" name="frame1" scrolling="auto" runat="server" style="float: left; width: 100%; height: 100%;"
              frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>