title: Struts2 jQuery UI dynamic Menu from Action List
body: <p>How can I generate dynamic menu &amp; menu items from a list generated at Action?
  I tried this approach but it is generating only main menu but not sub-menus.</p>
  <p><strong>Action class:</strong></p>
  <pre><code>private List&lt;String&gt; menuList = new ArrayList&lt;String&gt;();
  public String execute(){
      menuList.add(&quot;Menu1&quot;);
      menuList.add(&quot;Menu2&quot;);
      menuList.add(&quot;Menu3&quot;);
      menuList.add(&quot;Menu4&quot;);
      return &quot;success&quot;;
  }
  public List&lt;String&gt; getMenuList() {
      return menuList;
  }
  public void setMenuList(List&lt;String&gt; menuList) {
      this.menuList = menuList;
  }
  </code></pre>
  <p><strong>JSP:</strong></p>
  <pre><code>&lt;sj:menu cssStyle=&quot;width:50%&quot; list=&quot;menuList&quot; /&gt;
  </code></pre>
  <p>What can i do to get Menu with menu items?</p>
  <p><strong>Example classes structure:</strong></p>
  <pre><code>public class Menu {
      private String id;
      private List&lt;MenuItem&gt; menuItems;
  
      public Menu(String id, List&lt;MenuItem&gt; menuItems){
          this.id = id;
          this.menuItems = menuItems;
      }
  
      public String getId() {
          return id;
      }
      public void setId(String id) {
          this.id = id;
      }
      public List&lt;MenuItem&gt; getMenuItems() {
          return menuItems;
      }
      public void setMenuItems(List&lt;MenuItem&gt; menuItems) {
          this.menuItems = menuItems;
      }   
  }
  
  
  
  public class MenuItem {
      private String title;
      private String href;
      private Menu menu;  // submenu
  
      public MenuItem(String title, String href, Menu menu){
          this.title = title;
          this.href = href;
          this.menu = menu;
      }
  
      public String getTitle() {
          return title;
      }
      public void setTitle(String title) {
          this.title = title;
      }
      public String getHref() {
          return href;
      }
      public void setHref(String href) {
          this.href = href;
      }
      public Menu getMenu() {
          return menu;
      }
      public void setMenu(Menu menu) {
          this.menu = menu;
      }   
  }
  </code></pre>
  <p>How to configure this in JSP page with <code>sj:menu</code> tag?</p>