title: JSTL loop in JSP for nested unrodered lists
body: <p>MVC - servlet forwards request to JSP.
  In servlet i created list (java.util.List) of categories, attached this list to servlet context, and forwards request to JSP page:</p>
  
  <pre><code>public class Category{
         private Integer id;
         private String name;
         private Category parentCategory;
         ...
         //getters and setters
      }
  </code></pre>
  
  <p>This class represents category/subcategory (if parentCategory field is null, then it is top level category).
  Categories that have same parent, are its subcategories, and they are mapped to nested unordered list in JSP.
  Example: result should look similar to next HTML code:</p>
  
  <pre><code>&lt;ul class="droprightMenu"&gt;  
              &lt;li&gt;&lt;a href="#"&gt;Category 1&lt;/a&gt;
                  &lt;ul class="droprightMenu"&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 1.1&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 1.2&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 1.3&lt;/a&gt;&lt;/li&gt;
                            &lt;ul class="droprightMenu"&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 1.3.1&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 1.3.2&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 1.3.3&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 1.3.4&lt;/a&gt;&lt;/li&gt;
                            &lt;/ul&gt; 
                      &lt;li&gt;&lt;a href="#"&gt;Category 1.4&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Category 2&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Category 3&lt;/a&gt;&lt;/li&gt;
                  &lt;ul class="droprightMenu"&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 3.1&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 3.2&lt;/a&gt;&lt;/li&gt;
                            &lt;ul class="droprightMenu"&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 3.2.1&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href="#"&gt;Category 3.2.2&lt;/a&gt;&lt;/li&gt;
                            &lt;/ul&gt; 
                      &lt;li&gt;&lt;a href="#"&gt;Category 3.3&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a href="#"&gt;Category 3.4&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;li&gt;&lt;a href="#"&gt;Category 4&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>I don't know how to loop through this list in JSP. It should probably be done with some combination of different JSTL loops, or JSP scriptlets, maybe some recursion. 
  Appreciate any help.</p>