Java 如何使用struts 1.3.10在jsp中生成动态树视图?
请帮助我,如何在JSP中显示动态树视图 这是我的静态树视图: 以下是上述输出的编码:Java 如何使用struts 1.3.10在jsp中生成动态树视图?,java,javascript,jsp,struts2,struts-1,Java,Javascript,Jsp,Struts2,Struts 1,请帮助我,如何在JSP中显示动态树视图 这是我的静态树视图: 以下是上述输出的编码: <li> <a href=#><span class=icon-cogs></span> Expired</a> <ul> <li><a href=component_blocks.html>Blocks and panels&
<li> <a href=#><span class=icon-cogs></span> Expired</a>
<ul>
<li><a href=component_blocks.html>Blocks and panels</a></li>
<li><a href=component_buttons.html>Buttons</a></li>
<li><a href=component_modals.html>Modals and popups</a></li>
<li><a href=component_tabs.html>Tabs, accordion</a></li>
<li><a href=component_progress.html>Progressbars</a></li>
<li><a href=component_lists.html>List groups</a></li>
<li><a href=component_messages.html>Messages</a></li>
<li> <a href=#>Tables<i class="icon-angle-down pull-right"></i></a>
<ul>
<li><a href=component_table_default.html>Default tables</a></li>
<li><a href=component_table_sortable.html>Sortable tables<i class="icon-angle-down pull-right"></i></a>
<ul>
<li><a href=component_layout_blank.html>Default layout(blank)</a></li>
<li><a href=component_layout_custom.html>Custom navigation</a></li>
<li><a href=component_layout_scroll.html>Content scroll</a></li>
<li><a href=component_layout_fixed.html>Fixed content</a></li>
</ul>
</li>
</ul>
</li>
<li> <a href=#>Layouts<i class="icon-angle-down pull-right"></i></a>
<ul>
<li><a href=component_layout_blank.html>Default layout(blank)</a></li>
<li><a href=component_layout_custom.html>Custom navigation</a></li>
<li><a href=component_layout_scroll.html>Content scroll</a></li>
<li><a href=component_layout_fixed.html>Fixed content</a></li>
</ul>
</li>
<li><a href=component_charts.html>Charts</a></li>
<li><a href=component_maps.html>Maps</a></li>
<li><a href=component_typography.html>Typography</a></li>
<li><a href=component_gallery.html>Gallery</a></li>
<li><a href=component_calendar.html>Calendar</a></li>
<li><a href=component_icons.html>Icons</a></li>
</ul>
</li>
我的bean类(添加客户):
我的珠子等级(账户号):
我的jsp文件(business.jsp):
请帮助我,如何显示数据库数据的动态树视图
提前感谢。一旦升级到Struts2(因为struts1已被正式弃用) 您可以使用任何库绘制动态树-
我过去用过绘制动态树。该升级了,struts1不推荐使用。
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;
}
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
}
public class account_dao {
//Declare Variable
private long loginId;
private String name;
private String password;
private String role;
//Getter and Setter Methods
}
<li> <a href=#><span class=icon-pencil></span> All Customers</a>
<ul>
<%
session.setAttribute("customerList", add_customer_action.getCustomerList(account_name));
%>
<logic:iterate name="customerList" id="list">
<li><a href=form_elements.html><bean:write name="list" property="customerfullName"/></a></li>
</logic:iterate>
<!-- <li><a href=form_elements.html>Form elements</a></li>
<li><a href=form_editors.html>WYSIWYG and upload</a></li>
<li><a href=form_validation.html>Validation and wizard</a></li>-->
</ul>
</li>