displayclasspassurl.java
来自「程序简介: 由文章、下载、图片主要功能模块和广告、公告、调查、友情链接」· Java 代码 · 共 56 行
JAVA
56 行
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 + =
减小字号Ctrl + -
显示快捷键?