title: How can i generate dynamic tree view in jsp using struts 1.3.10?
body: <p>Please help me, how can i display dynamic tree view in JSP?</p>
  
  <p>This is my STATIC tree view:</p>
  
  <p><img src="https://i.stack.imgur.com/EYQnO.png" alt="Static Tree View"></p>
  
  <p>Here is coding for above output:</p>
  
  <pre><code>&lt;li&gt; &lt;a href=#&gt;&lt;span class=icon-cogs&gt;&lt;/span&gt; Expired&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href=component_blocks.html&gt;Blocks and panels&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_buttons.html&gt;Buttons&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_modals.html&gt;Modals and popups&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_tabs.html&gt;Tabs, accordion&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_progress.html&gt;Progressbars&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_lists.html&gt;List groups&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_messages.html&gt;Messages&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt; &lt;a href=#&gt;Tables&lt;i class="icon-angle-down pull-right"&gt;&lt;/i&gt;&lt;/a&gt;
                              &lt;ul&gt;
                                  &lt;li&gt;&lt;a href=component_table_default.html&gt;Default tables&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href=component_table_sortable.html&gt;Sortable tables&lt;i class="icon-angle-down pull-right"&gt;&lt;/i&gt;&lt;/a&gt;
                                      &lt;ul&gt;
                                          &lt;li&gt;&lt;a href=component_layout_blank.html&gt;Default layout(blank)&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href=component_layout_custom.html&gt;Custom navigation&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href=component_layout_scroll.html&gt;Content scroll&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href=component_layout_fixed.html&gt;Fixed content&lt;/a&gt;&lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                          &lt;li&gt; &lt;a href=#&gt;Layouts&lt;i class="icon-angle-down pull-right"&gt;&lt;/i&gt;&lt;/a&gt;
                              &lt;ul&gt;
                                  &lt;li&gt;&lt;a href=component_layout_blank.html&gt;Default layout(blank)&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href=component_layout_custom.html&gt;Custom navigation&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href=component_layout_scroll.html&gt;Content scroll&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a href=component_layout_fixed.html&gt;Fixed content&lt;/a&gt;&lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_charts.html&gt;Charts&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_maps.html&gt;Maps&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_typography.html&gt;Typography&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_gallery.html&gt;Gallery&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_calendar.html&gt;Calendar&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href=component_icons.html&gt;Icons&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
  </code></pre>
  
  <p>But i want this output for dynamic tree view from DataBase using(<strong>ArrayList</strong>) in Struts Framework.</p>
  
  <p>Herewith i have added coding below,</p>
  
  <p>my database(account_dao):</p>
  
  <p><img src="https://i.stack.imgur.com/VpT7H.png" alt="account_dao"></p>
  
  <p>my database(add_customer_dao):</p>
  
  <p><img src="https://i.stack.imgur.com/tPwBR.png" alt="add_customer_dao"></p>
  
  <p>my action class(add_customer_action):</p>
  
  <pre><code>    public static List getCustomerList(String customerName) {
      List customerList = null;
      long id = 0;
      String customer_Name = new String();
      try {
          /*Create Session Factory Object*/
          SessionFactory factory = new Configuration().configure().buildSessionFactory();
  
          /*Creating Session Object*/
          Session session = factory.openSession();
  
          /*Creating Transaction Object*/
          Transaction t = session.beginTransaction();
  
          try {
              /*Get Customer Full Name from DB where Login Name*/
              Query customer_name = session.createQuery("from add_customer_dao where customerLogin=?");
              customer_name.setString(0, customerName);
              List Customer_Name = customer_name.list();
              for (Iterator iterator = Customer_Name.iterator(); iterator.hasNext();) {
                  add_customer_dao Customer_Dao = (add_customer_dao) iterator.next();
                  customer_Name = Customer_Dao.getCustomerfullName().trim();
                  System.out.println("Customer Full Name : "+customer_Name);
              }
          } catch (Exception e) {
              throw new Exception(e);
          }
  
          try {
              /*Get Customer Account Id from DB*/
              Query account_id = session.createQuery("from account_dao where name=?");
              account_id.setString(0, customerName);
              List Account_Id = account_id.list();
              for (Iterator iterator = Account_Id.iterator(); iterator.hasNext();) {
                  account_dao Account_Dao = (account_dao) iterator.next();
                  id = Account_Dao.getId();
                  System.out.println("Account Id : " + id);
              }
          } catch (Exception e) {
              throw new Exception(e);
          }
  
          try {
              if (id != 0) {
                  /*Get CustomerList from DB where account_id*/
                  Query customer_list = session.createQuery("from add_customer_dao where accountId=?");
                  customer_list.setInteger(0, (int) id);
                  customerList = customer_list.list();
              }
          } catch (Exception e) {
          }
      } catch (Throwable ex) {
          throw new ExceptionInInitializerError(ex);
      }
      return customerList;
  }
  </code></pre>
  
  <p>my bean class(add_customer_dao):</p>
  
  <pre><code>public class add_customer_dao {
  
  private int customerId;
  private int accountId;
  private String customerfullName;
  private String customerLogin;
  private String customerPassword;
  private String confirmPassword;
  private String customerRole;
  private String customerMobile;
  private String customerTelephone;
  private String customerAddress;
  
   //Getter and Setter Methods
   }
  </code></pre>
  
  <p>my bead class(account_dao):</p>
  
  <pre><code> public class account_dao {
  
  //Declare Variable
  private long loginId;
  private String name;
  private String password;
  private String role;
  //Getter and Setter Methods
  }
  </code></pre>
  
  <p>my jsp file(business.jsp):</p>
  
  <pre><code> &lt;li&gt; &lt;a href=#&gt;&lt;span class=icon-pencil&gt;&lt;/span&gt; All Customers&lt;/a&gt;
                      &lt;ul&gt;
                          &lt;%
                              session.setAttribute("customerList", add_customer_action.getCustomerList(account_name));
                          %&gt;
                          &lt;logic:iterate name="customerList" id="list"&gt;
                              &lt;li&gt;&lt;a href=form_elements.html&gt;&lt;bean:write name="list" property="customerfullName"/&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;/logic:iterate&gt;
                          &lt;!--                            &lt;li&gt;&lt;a href=form_elements.html&gt;Form elements&lt;/a&gt;&lt;/li&gt;
                                                      &lt;li&gt;&lt;a href=form_editors.html&gt;WYSIWYG and upload&lt;/a&gt;&lt;/li&gt;
                                                      &lt;li&gt;&lt;a href=form_validation.html&gt;Validation and wizard&lt;/a&gt;&lt;/li&gt;--&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
  </code></pre>
  
  <p>Pls Help me, how can i display dynamic tree view for data from Database......</p>
  
  <p>Thanks in Advance.</p>