?? displayclasspassurl.java
字號:
package com.hao2007.struts.bean;
import com.hao2007.struts.db.DataStore;
import java.sql.ResultSet;
public class DisplayClassPassUrl {
private String str = "";
DataStore ds = DataStore.getInstance();
public String parent_list() throws Exception {
ds.beginTransaction();
ResultSet rs = null;
String sql = "select * from class where parent_id=0 order by id asc";
rs = ds.read(sql);
while (rs.next()) {
str += "<option value=" + rs.getInt("id") + ">"
+ rs.getString("name") + "</option>";
int id0 = rs.getInt("id");
this.sub_list(id0);
}
ds.commitTransaction();
return str;
}
public void sub_list(int id) throws Exception {
ResultSet rs1 = null;
String sql1 = "select * from class where parent_id='" + id
+ "' order by id asc";
rs1 = ds.read1(sql1);
while (rs1.next()) {
int id1 = rs1.getInt("id");
String name1 = rs1.getString("name");
int depth1 = rs1.getInt("sort_depth");
String path = "";
for (int i = 0; i <= depth1; i++) {
path = " " + path;
}
str += "<option value=" + id1 + ">" + path + "└-" + name1
+ "</option>";
sub_list(id1);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -