String categorySql = "select category_id as id,category_name as name from category order by category_level,category_id desc";
String commentSql = "select comment_id as id,comment_username as username,comment_content as content,comment_created_time as createdTime from comment";
// DBUTIL的核心类 生成对象时 传递数据源对象
QueryRunner qr = DbHelper.getQueryRunner();
// 使用BeanList构建对象List
List blogList = (List) qr.query(blogSql, new BeanListHandler(
Blog.class));
List categoryList = (List) qr.query(categorySql,
new BeanListHandler(Category.class));
List commentList = (List) qr.query(commentSql, new BeanListHandler(
Comment.class));
// 向JSP页面发送对象list
request.setAttribute("blogList", blogList);
request.setAttribute("categoryList", categoryList);
request.setAttribute("commentList", commentList);